From 9486766c806fe1d9e082b2fd02ea1cc558f1b443 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期四, 08 五月 2025 09:21:57 +0800
Subject: [PATCH] bug修改

---
 cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java |  502 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 349 insertions(+), 153 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 f10b1d3..0aec1a9 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
@@ -1,7 +1,7 @@
 package com.dsh.guns.modular.system.controller.code;
 
 import cn.hutool.crypto.SecureUtil;
-import cn.hutool.http.HttpRequest;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -9,32 +9,56 @@
 import com.dsh.course.feignClient.account.CityClient;
 import com.dsh.course.feignClient.account.model.CityListQuery;
 import com.dsh.course.feignClient.account.model.TCityManager;
+import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStore;
+import com.dsh.course.feignClient.communityWorldCup.Model.WorldCupStoreVO;
+import com.dsh.course.feignClient.communityWorldCup.WorldCupStoreClient;
 import com.dsh.course.feignClient.competition.CompetitionClient;
-import com.dsh.course.feignClient.other.model.Site;
 import com.dsh.course.mapper.UserMapper;
 import com.dsh.guns.config.UserExt;
 import com.dsh.guns.core.base.controller.BaseController;
 import com.dsh.guns.core.base.tips.SuccessTip;
 import com.dsh.guns.core.common.constant.factory.PageFactory;
 import com.dsh.guns.core.util.ToolUtil;
-import com.dsh.guns.modular.system.model.*;
-import com.dsh.guns.modular.system.service.*;
-import com.dsh.guns.modular.system.util.GaoDeMapUtil;
+import com.dsh.guns.modular.system.model.StoreConfig;
+import com.dsh.guns.modular.system.model.TCity;
+import com.dsh.guns.modular.system.model.TOperator;
+import com.dsh.guns.modular.system.model.TOperatorCity;
+import com.dsh.guns.modular.system.model.TStore;
+import com.dsh.guns.modular.system.model.TStoreListVo;
+import com.dsh.guns.modular.system.model.TStoreOther;
+import com.dsh.guns.modular.system.model.TStoreOtherConfig;
+import com.dsh.guns.modular.system.model.TStoreOtherConfigTrue;
+import com.dsh.guns.modular.system.model.TTurn;
+import com.dsh.guns.modular.system.model.User;
+import com.dsh.guns.modular.system.service.ICityService;
+import com.dsh.guns.modular.system.service.IStoreService;
+import com.dsh.guns.modular.system.service.ITSiteService;
+import com.dsh.guns.modular.system.service.IUserService;
+import com.dsh.guns.modular.system.service.StoreConfigService;
+import com.dsh.guns.modular.system.service.TOperatorCityService;
+import com.dsh.guns.modular.system.service.TOperatorService;
+import com.dsh.guns.modular.system.service.TStoreOtherConfigService;
+import com.dsh.guns.modular.system.service.TStoreOtherConfigTrueService;
+import com.dsh.guns.modular.system.service.TStoreOtherService;
+import com.dsh.guns.modular.system.service.TTurnService;
 import com.dsh.guns.modular.system.util.HttpRequestUtil;
-import io.swagger.models.auth.In;
-import org.apache.poi.ss.formula.functions.T;
-import org.bouncycastle.math.raw.Mod;
+import com.dsh.guns.modular.system.util.ImageUtils;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
+import org.springframework.util.CollectionUtils;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.ResponseBody;
 
 import javax.annotation.Resource;
-import java.util.*;
-import java.util.stream.Collectors;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * 车辆管理控制器
@@ -82,8 +106,54 @@
 
     @Autowired
     private ITSiteService siteService;
+    @Autowired
+    private IUserService userService;
+    @Autowired
+    private WorldCupStoreClient worldCupStoreClient;
 
 
+    // 添加SUTU
+    @RequestMapping("/tShop_addDevice/{id}")
+    public String addDevice(@PathVariable("id") Integer id,Model model) {
+        // 门店id
+        model.addAttribute("id",id);
+        return PREFIX + "TShop_add_device.html";
+    }
+
+    @RequestMapping("/addDevice")
+    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("name",device);
+        map.put("city_code","");
+        // 添加门禁
+        String s1 = HttpRequestUtil.postRequest
+                ("https://try.daowepark.c" +
+                        "om/v7/user_api/general/addSpaceSutu", map);
+        return SUCCESS_TIP;
+    }
+
+//    public static void main(String[] args) {
+////        HashMap<String, String> map = new HashMap<>();
+////        map.put("page","1");
+////        map.put("space_id","2010");
+////        // 获取门禁列表
+////        String s1 = HttpRequestUtil.getRequest
+////                ("https://port.daowepark.com/v7/user_api/general/getDevice", map);
+////        System.err.println(s1);
+//
+//        HashMap<String, String> map = new HashMap<>();
+//        map.put("sign","0DB011836143EEE2C2E072967C9F4E4B");
+//        map.put("space_id","1");
+//        map.put("device_id","1");
+//        map.put("region_id","2010");
+//        // 获取门禁列表
+//        String s1 = HttpRequestUtil.getRequest
+//                ("https://port.daowepark.com/v7/user_api/general/getDevice", map);
+//        System.err.println(s1);
+//    };
     /**
      * 跳转到车辆管理首页
      */
@@ -123,12 +193,12 @@
         }
 
 //        if (!roleid.equals("1")){
-            TOperator operator1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("userId", UserExt.getUser().getId()));
-            if(operator1!=null){
-                model.addAttribute("operator",operator1.getId());
-            }else {
-                model.addAttribute("operator",0);
-            }
+        TOperator operator1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("userId", UserExt.getUser().getId()));
+        if(operator1!=null){
+            model.addAttribute("operator",operator1.getId());
+        }else {
+            model.addAttribute("operator",0);
+        }
 //        }
 
         model.addAttribute("yysList",list1);
@@ -136,29 +206,61 @@
         return PREFIX + "TShop_add.html";
     }
     // 运营商根据省筛选市区
-    @RequestMapping("/getCityYys")
+    @RequestMapping("/getProvinceYys")
     @ResponseBody
-    public Object getCityYys(String province) {
-        Integer objectId = UserExt.getUser().getObjectId();
-
-        // todo
-        // 通过选择的省 获取管理的市
-        TOperatorCity byId = operatorCityService.getOne(new QueryWrapper<TOperatorCity>()
-                .eq("code",province).eq("operatorId",objectId));
-
-        List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>()
-                .eq("pid", province).eq("operatorId", UserExt.getUser().getObjectId()));
-        if (list.size() == 0){
-            // 管理整个省 获取这个省下的所有市
-            List<TCity> list1 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
-            // 拿到省的id
-            TCity code = cityService.getOne(new QueryWrapper<TCity>().eq("code", byId.getCode()));
-            // 获取省下面的所有市
-            return cityService.list(new QueryWrapper<TCity>().eq("parent_id", code.getId()));
+    public Object getProvinceYys(Integer operatorId) {
+        // 判断当前运营商是管理全国还是指定区域
+        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;
         }
+
+
+    }
+    // 运营商根据省筛选市区
+    @RequestMapping("/getCityYys")
+    @ResponseBody
+    public Object getCityYys(String province,Integer operatorId) {
+        if (UserExt.getUser().getObjectType() == 2){
+            operatorId = UserExt.getUser().getObjectId();
+        }
+        // 通过选择的省 获取管理的市
+        TOperatorCity byId = operatorCityService.getOne(new QueryWrapper<TOperatorCity>()
+                .eq("code",province).eq("operatorId",operatorId));
+        // 如果为null 则说明管理的全国
+        if (byId == null){
+            TCity code = cityService.getOne(new QueryWrapper<TCity>().eq("code", province));
+            return cityService.list(new QueryWrapper<TCity>().eq("parent_id",code.getId()));
+        }else{
+            List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>()
+                    .eq("operatorId", operatorId)
+                    .eq("pid",byId.getId()));
+            if (list.size() == 0){
+                // 说明管理整个省
+                TCity code = cityService.getOne(new QueryWrapper<TCity>().eq("code", byId.getCode()));
+                // 获取省下面的所有市
+                return cityService.list(new QueryWrapper<TCity>().eq("parent_id", code.getId()));
+            }else{
+                // 没有管理整个省 获取对应的市
+                return list;
+            }
+        }
+    }
+    // 运营商赛事添加 根据所选市 获取门店
+    @RequestMapping("/getStoresYys")
+    @ResponseBody
+    public Object getStoresYys(String cityCode) {
+        Integer objectId = UserExt.getUser().getObjectId();
+        List<TStore> stores = storeService.list(new QueryWrapper<TStore>().eq("operatorId", objectId)
+                .eq("cityCode", cityCode));
+        return stores;
     }
 
     @RequestMapping("/tShop_add_one")
@@ -199,12 +301,13 @@
         List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
 
 //        TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId.getProvinceCode()));
-        List<TOperatorCity> one = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, byId.getOperatorId()).eq(TOperatorCity::getType, 1));
-        List<TOperatorCity> ones = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, byId.getOperatorId()).eq(TOperatorCity::getType, 1));
+        List<TOperatorCity> ones = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>()
+                .eq(TOperatorCity::getOperatorId, byId.getOperatorId())
+                .eq(TOperatorCity::getPid, 0));
 
         if(ones.size()>0){
             model.addAttribute("list",ones);
-            TOperatorCity one1 = operatorCityService.getOne(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, byId.getOperatorId()).eq(TOperatorCity::getType, 1).eq(TOperatorCity::getCode,byId.getProvinceCode()));
+            TOperatorCity one1 = operatorCityService.getOne(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, byId.getOperatorId()).eq(TOperatorCity::getPid, 0).eq(TOperatorCity::getCode,byId.getProvinceCode()));
             List<TOperatorCity> list3 = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().in(TOperatorCity::getPid, one1.getId()).eq(TOperatorCity::getType, 2));
             model.addAttribute("list1",list3);
             System.out.println("===list3======="+list3);
@@ -228,11 +331,25 @@
 
         model.addAttribute("list2",list2.getRecords());
         String roleid = UserExt.getUser().getRoleid();
-            model.addAttribute("role",roleid);
+        model.addAttribute("role",roleid);
         model.addAttribute("time",byId.getStartTime()+" - "+byId.getEndTime());
         User byId1 = userMapper.selectById(byId.getStoreStaffId());
         model.addAttribute("city",byId1);
         model.addAttribute("type",1);
+        // 如果当前登陆人是运营商
+        if (UserExt.getUser().getObjectType()==2){
+            // 查询这个运营商管理的省
+            TOperator id1 = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("id", UserExt.getUser().getObjectId()));
+            if (id1.getType()==1){
+                // 全国
+                List<TCity> list3 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0));
+                model.addAttribute("list",list3);
+            }else{
+                // 找到他管理的省
+                List<TOperatorCity> list4 = operatorCityService.list(new QueryWrapper<TOperatorCity>().eq("operatorId", UserExt.getUser().getObjectId()).eq("pid", 0));
+                model.addAttribute("list",list4);
+            }
+        }
         return PREFIX + "TShop_edit.html";
     }
     @RequestMapping("/tShop_update1/{id}")
@@ -300,6 +417,7 @@
         User byId1 = userMapper.selectById(byId.getStoreStaffId());
         model.addAttribute("city",byId1);
         model.addAttribute("type",0);
+
         return PREFIX + "TShop_edit.html";
     }
     @RequestMapping("/tShop_gift/{id}")
@@ -328,6 +446,15 @@
         StoreConfig c8 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,8));
         model.addAttribute("c8",c8);
         model.addAttribute("id",id);
+        List<WorldCupStoreVO> worldCupStores = worldCupStoreClient.getWorldCupStoreListByStoreId(id);
+        if (CollectionUtils.isEmpty(worldCupStores)){
+            model.addAttribute("worldCupStores",new ArrayList<>());
+        }else{
+            model.addAttribute("worldCupStores",worldCupStores);
+        }
+        //玩湃惠民卡
+        StoreConfig c10 = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType,10));
+        model.addAttribute("c10",c10);
         return PREFIX + "TShop_imgAll.html";
     }
 
@@ -377,8 +504,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;
             }
@@ -386,19 +511,21 @@
                 List<TOperatorCity> list1 = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, yyId));
                 if(list1.size()>0){
                     if (ToolUtil.isNotEmpty(tStore.getProvinceCode())) {
-                        TOperatorCity byId = operatorCityService.getById(tStore.getProvinceCode());
+                        TOperatorCity byId = operatorCityService.getOne(new QueryWrapper<TOperatorCity>().eq("code",tStore.getProvinceCode())
+                                .eq("operatorId",yyId));
                         TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId.getCode()));
                         tStore.setProvince(one.getName());
                         tStore.setProvinceCode(one.getCode());
                         List<TOperatorCity> list = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getPid, byId.getId()).eq(TOperatorCity::getType, 2));
                         if (list.size() > 0) {
-                            TOperatorCity byId1 = operatorCityService.getById(tStore.getCityCode());
+                            TOperatorCity byId1 = operatorCityService.getOne(new QueryWrapper<TOperatorCity>().eq("code",tStore.getCityCode())
+                                    .eq("operatorId",yyId));
                             TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId1.getCode()));
                             tStore.setCity(one1.getName());
                             tStore.setCityCode(one1.getCode());
                         } else {
                             TCity byId1 = cityService.getById(tStore.getCityCode());
-                            TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId1.getCode()));
+                            TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getCityCode()));
                             tStore.setCity(one1.getName());
                             tStore.setCityCode(one1.getCode());
                         }
@@ -450,40 +577,16 @@
             user.setStatus(1);
             userMapper.insert(user);
             tStore.setStoreStaffId(user.getId());
-                tStore.setLon(lon);
-                tStore.setLat(lat);
-            tStore.setOperatorId(UserExt.getUser().getObjectId());
-            storeService.save(tStore);
-            user.setObjectId(tStore.getId());
-
-
-
-
-            // 添加场地
-            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);
+            tStore.setLon(lon);
+            tStore.setLat(lat);
+            if (yyId == null || yyId == 0){
+                tStore.setOperatorId(0);
+            }else{
+                tStore.setOperatorId(yyId);
             }
-            storeConfigService.saveBatch(storeConfigs);
-
+            if (UserExt.getUser().getObjectType()==2){
+                tStore.setOperatorId(UserExt.getUser().getObjectId());
+            }
 
             // 添加门店
             HashMap<String, String> map1 = new HashMap<>();
@@ -499,25 +602,43 @@
             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);
+            String result = HttpRequestUtil.postRequest("https://port.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);
+            user.setObjectId(tStore.getId());
+            userService.updateById(user);
+            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> 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://port.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://port.daowepark.com/v7/user_api/general/addDevice", map);
+//                System.out.println(s1);
+//            }
             return new SuccessTip<>();
         }catch (Exception e){
             e.printStackTrace();
@@ -541,18 +662,21 @@
                 List<TOperatorCity> list1 = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getOperatorId, yyId));
                 if(list1.size()>0){
                     if (ToolUtil.isNotEmpty(tStore.getProvinceCode())) {
-                        TOperatorCity byId = operatorCityService.getById(tStore.getProvinceCode());
+                        TOperatorCity byId = operatorCityService.getOne(new QueryWrapper<TOperatorCity>().eq("operatorId", yyId)
+                                .eq("code", tStore.getProvinceCode()));
                         TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId.getCode()));
                         tStore.setProvince(one.getName());
                         tStore.setProvinceCode(one.getCode());
-                        List<TOperatorCity> list = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>().eq(TOperatorCity::getPid, byId.getId()).eq(TOperatorCity::getType, 2));
+                        List<TOperatorCity> list = operatorCityService.list(new LambdaQueryWrapper<TOperatorCity>()
+                                .eq(TOperatorCity::getPid, byId.getId()).ne(TOperatorCity::getPid, 0));
                         if (list.size() > 0) {
-                            TOperatorCity byId1 = operatorCityService.getById(tStore.getCityCode());
+                            TOperatorCity byId1 = operatorCityService.getOne(new QueryWrapper<TOperatorCity>().eq("operatorId", yyId)
+                                    .eq("code", tStore.getCityCode()));
                             TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId1.getCode()));
                             tStore.setCity(one1.getName());
                             tStore.setCityCode(one1.getCode());
                         } else {
-                            TCity byId1 = cityService.getById(tStore.getCityCode());
+                            TCity byId1 = cityService.getOne(new QueryWrapper<TCity>().eq("code",tStore.getCityCode()));
                             TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId1.getCode()));
                             tStore.setCity(one1.getName());
                             tStore.setCityCode(one1.getCode());
@@ -568,10 +692,10 @@
                 }
 
             }else {
-                        TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getId, tStore.getProvinceCode()));
+                TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getProvinceCode()));
                 tStore.setProvince(one.getName());
                 tStore.setProvinceCode(one.getCode());
-                TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getId, tStore.getCityCode()));
+                TCity one1 = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, tStore.getCityCode()));
                 tStore.setCity(one1.getName());
                 tStore.setCityCode(one1.getCode());
             }
@@ -594,30 +718,11 @@
             userMapper.updateById(user);
             tStore.setLon(lon);
             tStore.setLat(lat);
+            // 运营商编辑
+            if (UserExt.getUser().getObjectType()==2){
+                tStore.setOperatorId(null);
+            }
             storeService.updateById(tStore);
-            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){
@@ -638,9 +743,9 @@
     }
     @RequestMapping(value = "/saveImgAll")
     @ResponseBody
-    public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,
-                             String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,
-                             Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8) {
+    public Object saveImgAll(Integer id,Integer px1,Integer px2,Integer px3,Integer px4,Integer px5,Integer px6,Integer px7,Integer px8,Integer px10,
+                             String c1,String c2,String c3,String c4,String c5,String c6,String c7,String c8,String c10,
+                             Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,Integer r10,String str) {
         try {
             ArrayList<StoreConfig> storeConfigs = new ArrayList<>();
             StoreConfig collect1 = collect(id, px1, r1, c1, 1);
@@ -651,6 +756,7 @@
             StoreConfig collect6 = collect(id, px6, r6, c6, 6);
             StoreConfig collect7 = collect(id, px7, r7, c7, 7);
             StoreConfig collect8 = collect(id, px8, r8, c8, 8);
+            StoreConfig collect10 = collect(id, px10, r10, c10, 10);
             storeConfigs.add(collect1);
             storeConfigs.add(collect2);
             storeConfigs.add(collect3);
@@ -659,7 +765,31 @@
             storeConfigs.add(collect6);
             storeConfigs.add(collect7);
             storeConfigs.add(collect8);
-            storeConfigService.updateBatchById(storeConfigs);
+            storeConfigs.add(collect10);
+            storeConfigService.saveOrUpdateBatch(storeConfigs);
+
+            // 修改世界杯
+            JSONArray jsonArray = JSONObject.parseArray(str);
+            List<WorldCupStore> worldCupStores = new ArrayList<>();
+            for (Object o : jsonArray) {
+                String s = JSONObject.toJSONString(o);
+                JSONObject jsonObject = JSONObject.parseObject(s);
+                Integer id1 = jsonObject.getInteger("id");
+                String backgroundImage = jsonObject.getString("backgroundImage");
+                Integer isOpen = jsonObject.getInteger("isOpen");
+                Integer sort = jsonObject.getInteger("sort");
+                WorldCupStore worldCupStore = new WorldCupStore();
+                worldCupStore.setSort(sort);
+                worldCupStore.setId(id1);
+                worldCupStore.setBackgroundImage(backgroundImage);
+                if (ToolUtil.isNotEmpty(backgroundImage)) {
+                    worldCupStore.setDisplayType(ImageUtils.getImageDimensions(backgroundImage).getDisplayType());
+                }
+                worldCupStore.setIsOpen(isOpen);
+                worldCupStores.add(worldCupStore);
+            }
+            worldCupStoreClient.updateWorldCupStoreListById(worldCupStores);
+
             return new SuccessTip<>();
         }catch (Exception e){
             e.printStackTrace();
@@ -668,11 +798,33 @@
     }
 
     private StoreConfig collect(Integer id,Integer sort,Integer isOpen,String img,int type){
-        StoreConfig one = storeConfigService.getOne(new LambdaQueryWrapper<StoreConfig>().eq(StoreConfig::getStoreId, id).eq(StoreConfig::getType, type));
-        one.setSort(sort);
-        one.setIsOpen(isOpen);
-        if(ToolUtil.isNotEmpty(img)){
-            one.setBackgroundImage(img);
+        StoreConfig one = storeConfigService.getOne(new QueryWrapper<StoreConfig>()
+                .eq("storeId", id)
+                .eq("type", type));
+        try {
+            if (one != null) {
+                one.setSort(sort);
+                one.setIsOpen(isOpen);
+                if (ToolUtil.isNotEmpty(img)) {
+                    one.setBackgroundImage(img);
+                    one.setDisplayType(ImageUtils.getImageDimensions(img).getDisplayType());
+                }
+            }
+            if (one == null) {
+                StoreConfig storeConfig = new StoreConfig();
+                storeConfig.setStoreId(id);
+                storeConfig.setType(type);
+                storeConfig.setIsOpen(isOpen);
+                storeConfig.setSort(sort);
+                storeConfig.setBackgroundImage(img);
+                if (ToolUtil.isNotEmpty(img)) {
+                    storeConfig.setDisplayType(ImageUtils.getImageDimensions(img).getDisplayType());
+                }
+                storeConfigService.save(storeConfig);
+                return storeConfig;
+            }
+        } catch (IOException e) {
+            throw new RuntimeException(e);
         }
         return one;
     }
@@ -772,8 +924,7 @@
     @RequestMapping(value = "/deleteTwo")
     public Object delete2(Integer id) {
         try {
-            storeOtherConfigService.removeById(id);
-
+            tStoreOtherConfigTrueService.removeById(id);
             return SUCCESS_TIP;
         }catch (Exception e){
             e.printStackTrace();
@@ -812,9 +963,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();
@@ -825,9 +982,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();
@@ -899,7 +1062,7 @@
     @ResponseBody
     public Object addConfigOne(String url,String name,Integer page,Integer type,String  turnId,Integer sort) {
         try {
-             storeService.addConfigOne(url,name,page,type,turnId,sort);
+            storeService.addConfigOne(url,name,page,type,turnId,sort);
             return SUCCESS_TIP;
         }catch (Exception e){
             e.printStackTrace();
@@ -908,13 +1071,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表数据
@@ -931,7 +1095,7 @@
             }
 
 
-        return SUCCESS_TIP;
+            return SUCCESS_TIP;
         }catch (Exception e){
             e.printStackTrace();
             return ERROR;
@@ -939,16 +1103,15 @@
     }
     @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);
 
 
-        return SUCCESS_TIP;
+            return SUCCESS_TIP;
         }catch (Exception e){
             e.printStackTrace();
             return ERROR;
@@ -987,10 +1150,14 @@
                 byId.setUrl(url);
             }
             byId.setName(name);
-            TTurn byId1 = tTurnService.getById(page);
-            TTurn byId2 = tTurnService.getById(type);
-            byId.setPage(byId1.getName());
-            byId.setType(byId2.getName());
+            if(page!=null){
+                TTurn byId1 = tTurnService.getById(page);
+                byId.setPage(byId1.getName());
+            }
+            if(page!=null){
+                TTurn byId2 = tTurnService.getById(type);
+                byId.setType(byId2.getName());
+            }
             byId.setTurnId(turnId);
             byId.setSort(sort);
             byId.setPageId(page);
@@ -1003,7 +1170,36 @@
         }
     }
 
-
+    @RequestMapping(value = "/addConfigOne9")
+    @ResponseBody
+    public Object addConfigOne9(String url,String name,Integer page,Integer type,String  turnId,Integer sort,Integer id) {
+        try {
+            TStoreOtherConfigTrue byId = new TStoreOtherConfigTrue();
+            byId.setPid(id);
+            if(ToolUtil.isNotEmpty(url)){
+                byId.setUrl(url);
+            }
+            byId.setName(name);
+            if(page!=null){
+                TTurn byId1 = tTurnService.getById(page);
+                byId.setPage(byId1.getName());
+            }
+            if(page!=null){
+                TTurn byId2 = tTurnService.getById(type);
+                byId.setType(byId2.getName());
+            }
+            byId.setTurnId(turnId);
+            byId.setSort(sort);
+            byId.setPageId(page);
+            byId.setTypeId(type);
+            byId.setState(1);
+            tStoreOtherConfigTrueService.save(byId);
+            return SUCCESS_TIP;
+        }catch (Exception e){
+            e.printStackTrace();
+            return ERROR;
+        }
+    }
 
 
 }

--
Gitblit v1.7.1