From 5b83b50d38c757b38dcc87a40a17d34cc2948e10 Mon Sep 17 00:00:00 2001 From: puzhibing <393733352@qq.com> Date: 星期五, 15 三月 2024 09:49:15 +0800 Subject: [PATCH] Merge branch '2.0' of http://120.76.84.145:10101/gitblit/r/java/PlayPai into 2.0 --- cloud-server-management/src/main/java/com/dsh/guns/modular/system/controller/code/TShopController.java | 295 +++++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 196 insertions(+), 99 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 9e87d2c..9f4e903 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 @@ -2,6 +2,7 @@ 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,6 +10,9 @@ 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; @@ -28,7 +32,9 @@ 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.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; @@ -84,29 +90,52 @@ 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) { - // 查询门店下的所有场地 - 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) { + public Object addDevice(Integer id,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()); + map.put("space_id",id.toString()); + map.put("name",device); + map.put("city_code",""); // 添加门禁 - String s1 = HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addDevice", map); + 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://try.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://try.daowepark.com/v7/user_api/general/getDevice", map); + System.err.println(s1); + }; /** * 跳转到车辆管理首页 */ @@ -146,12 +175,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); @@ -162,17 +191,28 @@ @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") @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)); @@ -183,7 +223,7 @@ }else{ List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>() .eq("operatorId", operatorId) - .eq("pid",byId.getId())); + .eq("pid",byId.getId())); if (list.size() == 0){ // 说明管理整个省 TCity code = cityService.getOne(new QueryWrapper<TCity>().eq("code", byId.getCode())); @@ -273,7 +313,7 @@ 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); @@ -359,6 +399,7 @@ User byId1 = userMapper.selectById(byId.getStoreStaffId()); model.addAttribute("city",byId1); model.addAttribute("type",0); + return PREFIX + "TShop_edit.html"; } @RequestMapping("/tShop_gift/{id}") @@ -387,6 +428,12 @@ 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); + } return PREFIX + "TShop_imgAll.html"; } @@ -436,8 +483,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; } @@ -446,7 +491,7 @@ if(list1.size()>0){ if (ToolUtil.isNotEmpty(tStore.getProvinceCode())) { TOperatorCity byId = operatorCityService.getOne(new QueryWrapper<TOperatorCity>().eq("code",tStore.getProvinceCode()) - .eq("operatorId",yyId)); + .eq("operatorId",yyId)); TCity one = cityService.getOne(new LambdaQueryWrapper<TCity>().eq(TCity::getCode, byId.getCode())); tStore.setProvince(one.getName()); tStore.setProvinceCode(one.getCode()); @@ -511,45 +556,19 @@ user.setStatus(1); userMapper.insert(user); tStore.setStoreStaffId(user.getId()); - tStore.setLon(lon); - tStore.setLat(lat); - if (yyId == null || yyId == 0){ - tStore.setOperatorId(0); - }else{ - tStore.setOperatorId(yyId); - } - storeService.save(tStore); + tStore.setLon(lon); + tStore.setLat(lat); + if (yyId == null || yyId == 0){ + tStore.setOperatorId(0); + }else{ + tStore.setOperatorId(yyId); + } + if (UserExt.getUser().getObjectType()==2){ + tStore.setOperatorId(UserExt.getUser().getObjectId()); + } + 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); - - // 添加门店 HashMap<String, String> map1 = new HashMap<>(); map1.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); @@ -564,11 +583,42 @@ 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); - - + 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); + 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://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(); @@ -653,27 +703,6 @@ 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){ @@ -696,7 +725,7 @@ @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) { + Integer r1,Integer r2,Integer r3,Integer r4,Integer r5,Integer r6,Integer r7,Integer r8,String str) { try { ArrayList<StoreConfig> storeConfigs = new ArrayList<>(); StoreConfig collect1 = collect(id, px1, r1, c1, 1); @@ -716,6 +745,26 @@ storeConfigs.add(collect7); storeConfigs.add(collect8); storeConfigService.updateBatchById(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); + worldCupStore.setIsOpen(isOpen); + worldCupStores.add(worldCupStore); + } + worldCupStoreClient.updateWorldCupStoreListById(worldCupStores); + return new SuccessTip<>(); }catch (Exception e){ e.printStackTrace(); @@ -724,12 +773,27 @@ } 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)); + if (one!=null){ + one.setSort(sort); + one.setIsOpen(isOpen); + if(ToolUtil.isNotEmpty(img)){ + one.setBackgroundImage(img); + } } + if (one == null){ + StoreConfig storeConfig = new StoreConfig(); + storeConfig.setStoreId(id); + storeConfig.setType(type); + storeConfig.setIsOpen(isOpen); + storeConfig.setSort(sort); + storeConfig.setBackgroundImage(img); + storeConfigService.save(storeConfig); + return storeConfig; + } + return one; } @RequestMapping(value = "/oneChangeNext") @@ -967,7 +1031,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(); @@ -1000,7 +1064,7 @@ } - return SUCCESS_TIP; + return SUCCESS_TIP; }catch (Exception e){ e.printStackTrace(); return ERROR; @@ -1016,7 +1080,7 @@ storeOtherService.updateById(byId); - return SUCCESS_TIP; + return SUCCESS_TIP; }catch (Exception e){ e.printStackTrace(); return ERROR; @@ -1055,10 +1119,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); @@ -1071,7 +1139,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