| | |
| | | package com.dsh.guns.modular.system.controller.code; |
| | | import java.math.BigDecimal; |
| | | |
| | | import cn.hutool.core.collection.CollectionUtil; |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | |
| | | import groovyjarjarpicocli.CommandLine; |
| | | import net.bytebuddy.asm.Advice; |
| | | import org.apache.http.HttpResponse; |
| | | import org.apache.poi.ss.formula.functions.T; |
| | | import org.aspectj.weaver.ast.Var; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.http.HttpRequest; |
| | | import org.springframework.stereotype.Controller; |
| | | import org.springframework.ui.Model; |
| | | import org.springframework.util.StringUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.servlet.resource.HttpResource; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.lang.reflect.Type; |
| | |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | model.addAttribute("userType",objectType); |
| | | List<CityManager> province = cityManagerClient.listAll(); |
| | | // 已有城市管理的省 |
| | | ArrayList<String> list1 = new ArrayList<>(); |
| | | // 已有城市管理的市 |
| | | ArrayList<String> list2 = new ArrayList<>(); |
| | | for (CityManager cityManager : province) { |
| | | list1.add(cityManager.getProvince()); |
| | | list2.add(cityManager.getCity()); |
| | | } |
| | | HashSet<String> set = new HashSet<String>(list1); |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | QueryWrapper<TSiteType> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state",1); |
| | | List<TSiteType> siteType = siteTypeService.list(wrapper); |
| | | model.addAttribute("list",set); |
| | | List<TCity> list3 = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list3); |
| | | model.addAttribute("siteType",siteType); |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",objectId); |
| | | model.addAttribute("type",1); |
| | | List<TOperator> list5 = tOperatorService.list(); |
| | | model.addAttribute("list5",list5); |
| | | return PREFIX + "TSite.html"; |
| | | } |
| | | /** |
| | |
| | | @RequestMapping("/addSiteLock") |
| | | @ResponseBody |
| | | public Object addSiteLock(@RequestBody TSiteLockDTO dto){ |
| | | SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | try { |
| | | dto.setStartTime(simpleDateFormat.parse(dto.getSsTime())); |
| | | dto.setEndTime(simpleDateFormat.parse(dto.getEeTime())); |
| | | } catch (ParseException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | // SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| | | // try { |
| | | // dto.setStartTime(simpleDateFormat.parse(dto.getSsTime())); |
| | | // dto.setEndTime(simpleDateFormat.parse(dto.getEeTime())); |
| | | // } catch (ParseException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | |
| | | System.out.println(dto); |
| | | Object o = siteLockClient.addSiteLock(dto); |
| | | return ResultUtil.success(o); |
| | | } |
| | |
| | | strings.add(cityManager.getCity()); |
| | | } |
| | | HashSet<String> set1 = new HashSet<String>(strings); |
| | | List<Store> stores = new ArrayList<>(); |
| | | if (objectType ==2 ){ |
| | | stores= storeClient.getStoreByCityManagerId(objectId); |
| | | }else if(objectType == 3){ |
| | | stores= storeClient.getStoreByStoreStaffId(objectId);; |
| | | List<TStore> stores = new ArrayList<>(); |
| | | // // 先判断 |
| | | // if (objectType ==2 ){ |
| | | // stores= storeClient.getStoreByCityManagerId(objectId); |
| | | // }else if(objectType == 3){ |
| | | // stores= storeClient.getStoreByStoreStaffId(objectId);; |
| | | // }else{ |
| | | // stores = storeClient.getStore(site.getCity()); |
| | | // } |
| | | // 根据门店id 确定是平台还是运营商的 |
| | | TStore byId = storeService.getById(site.getStoreId()); |
| | | if (byId.getType()==1){ |
| | | // 查询平台的门店 |
| | | if (objectType ==2 ){ |
| | | stores = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("state", 1) |
| | | .eq("type", 1) |
| | | .eq("operatorId",objectId)); |
| | | }else if (objectType ==2 ){ |
| | | stores = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("state", 1) |
| | | .eq("id",objectId)); |
| | | }else{ |
| | | stores = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("state", 1) |
| | | .eq("type", 1) |
| | | ); |
| | | } |
| | | }else{ |
| | | stores = storeClient.getStore(site.getCity()); |
| | | // 查询平台的门店 |
| | | if(objectType == 2){ |
| | | stores = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("state", 1) |
| | | .eq("type", 2) |
| | | .eq("operatorId",objectId)); |
| | | }else if (objectType == 3){ |
| | | stores = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("state", 1) |
| | | .eq("id",objectId)); |
| | | }else{ |
| | | stores = storeService.list(new QueryWrapper<TStore>() |
| | | .eq("state", 1) |
| | | .eq("type", 2) |
| | | ); |
| | | } |
| | | |
| | | } |
| | | List<CityManager> accounts = cityManagerClient.getAccount(site.getCity()); |
| | | model.addAttribute("list",site); |
| | |
| | | model.addAttribute("type",1); |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",objectId); |
| | | |
| | | model.addAttribute("stores",stores); |
| | | |
| | | String nextName = site.getNextName(); |
| | |
| | | for (String s : nextName.split(",")) { |
| | | strings1.add(s); |
| | | } |
| | | model.addAttribute("nextNames",strings1); |
| | | |
| | | if (!strings1.get(0).equals("")){ |
| | | System.out.println("=========执行nextNames===="); |
| | | model.addAttribute("nextNames",strings1);} |
| | | |
| | | ArrayList<String> strings3 = new ArrayList<>(); |
| | | strings3.add("普通场地"); |
| | | strings3.add("智慧场地"); |
| | | model.addAttribute("typeNames",strings3); |
| | | |
| | | String halfNames = site.getHalfName(); |
| | | ArrayList<String> strings2 = new ArrayList<>(); |
| | |
| | | }else{ |
| | | stores = storeClient.getStore(site.getCity()); |
| | | } |
| | | |
| | | ArrayList<String> strings3 = new ArrayList<>(); |
| | | strings3.add("普通场地"); |
| | | strings3.add("智慧场地"); |
| | | model.addAttribute("typeNames",strings3); |
| | | |
| | | |
| | | String nextName = site.getNextName(); |
| | | ArrayList<String> strings1 = new ArrayList<>(); |
| | | for (String s : nextName.split(",")) { |
| | | strings1.add(s); |
| | | } |
| | | System.out.println("========="+strings1); |
| | | System.out.println("====000====="+strings1.get(0)); |
| | | |
| | | if (CollectionUtil.isNotEmpty(strings1)) { |
| | | System.out.println("====执行==="); |
| | | model.addAttribute("nextNames", strings1); |
| | | } |
| | | |
| | | |
| | | String halfNames = site.getHalfName(); |
| | | ArrayList<String> strings2 = new ArrayList<>(); |
| | | String[] split = halfNames.split(","); |
| | | String halfName=null; |
| | | for (int i = 0; i < split.length; i++) { |
| | | if(i==0){ |
| | | halfName = split[0]; |
| | | }else { |
| | | strings2.add(split[i]); |
| | | } |
| | | } |
| | | model.addAttribute("halfNames",strings2); |
| | | model.addAttribute("halfName",halfName); |
| | | |
| | | List<CityManager> accounts = cityManagerClient.getAccount(site.getCity()); |
| | | model.addAttribute("list",site); |
| | | Date insuranceEndTime = site.getInsuranceEndTime(); |
| | |
| | | site.setCityManagerId(cityManagerId); |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | siteClient.addSite(site); |
| | | // site.setOperatorId(UserExt.getUser().getObjectId()); |
| | | |
| | | // 添加场地 |
| | | HashMap<String, String> map = new HashMap<>(); |
| | | map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | map.put("name",site.getName()); |
| | | map.put("short_name",site.getName()); |
| | | map.put("location",city); |
| | | map.put("address",store.getAddress()); |
| | | map.put("telephone",store.getPhone()); |
| | | map.put("linkman",""); |
| | | map.put("business_time","[{\"start_time\":\"00:00\",\"close_time\":\"23:59\"}]"); |
| | | map.put("logo",store.getCoverDrawing()); |
| | | map.put("remark",site.getIntroduce()); |
| | | map.put("lat",store.getLat()); |
| | | map.put("lng",store.getLon()); |
| | | HttpRequestUtil.postRequest("https://try.daowepark.com/v7/user_api/general/addSpace", map); |
| | | map.put("space_id",store.getId().toString()); |
| | | String s = HttpRequestUtil.postRequest |
| | | ("https://port.daowepark.com/v7/user_api/general/addSpaceArea", map); |
| | | JSONObject jsonObject = JSONObject.parseObject(s); |
| | | JSONObject data = jsonObject.getJSONObject("data"); |
| | | String area_id = data.getString("area_id"); |
| | | Integer integer = Integer.valueOf(area_id); |
| | | site.setId(integer); |
| | | Integer integer1 = siteClient.addSite1(site); |
| | | // Integer integer = Integer.valueOf(spaceId); |
| | | |
| | | return ResultUtil.success("添加成功"); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 编辑场地管理 |
| | | */ |
| | |
| | | if(site.getInsuranceImg().equals("")){ |
| | | site.setInsuranceImg(null); |
| | | } |
| | | |
| | | TSite byId = siteService.getById(site.getId()); |
| | | |
| | | Store store = storeClient.getStoreById(site.getStoreId()); |
| | | |
| | | String province = store.getProvince(); |
| | |
| | | site.setInsertTime(new Date()); |
| | | site.setState(1); |
| | | siteClient.addSite(site); |
| | | |
| | | /** |
| | | * 取消闸机输入 新增模块闸机管理 |
| | | */ |
| | | // String ids = byId.getIds(); |
| | | // HashMap<String, String> map = new HashMap<>(); |
| | | // map.put("sign","0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // if(StringUtils.hasLength(ids)) { |
| | | // for (String s : ids.split(",")) { |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/deleteDevice/ids/" + s, map); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | // if(StringUtils.hasLength( site.getIds())) { |
| | | // for (String s : site.getIds().split(",")) { |
| | | // HashMap<String, String> map1 = new HashMap<>(); |
| | | // map1.put("sign", "0DB011836143EEE2C2E072967C9F4E4B"); |
| | | // map1.put("space_id", store.getId() + ""); |
| | | // map1.put("device_id", s); |
| | | // map1.put("region_id", site.getId() + ""); |
| | | // // 添加门禁 |
| | | // String s1 = HttpRequestUtil.postRequest("https://port.daowepark.com/v7/user_api/general/addDevice", map1); |
| | | // System.out.println(s1); |
| | | // } |
| | | // } |
| | | |
| | | |
| | | |
| | | return ResultUtil.success(); |
| | | } |
| | | /** |
| | |
| | | */ |
| | | @RequestMapping(value= "/listExipre") |
| | | @ResponseBody |
| | | public List<TSiteDTO> listExipre(String province,String city,String storeName,Integer siteTypeId,String name) { |
| | | public List<TSiteDTO> listExipre(String province,String city,String storeName,Integer siteTypeId,String name,Integer opId) { |
| | | // 对象类型 |
| | | Integer type = UserExt.getUser().getObjectType(); |
| | | // 对象类型Id |
| | |
| | | vo.setName(name); |
| | | vo.setObjectType(type); |
| | | vo.setObjectId(objectId); |
| | | return siteClient.listExipre(vo); |
| | | vo.setOpId(opId); |
| | | List<TSiteDTO> tSiteDTOS = siteClient.listExipre(vo); |
| | | for (TSiteDTO tSiteDTO : tSiteDTOS) { |
| | | Integer storeId = tSiteDTO.getStoreId(); |
| | | TStore byId = storeService.getById(storeId); |
| | | if (byId!=null){ |
| | | if (byId.getType()==1){ |
| | | tSiteDTO.setOperator("平台"); |
| | | }else{ |
| | | TOperator byId1 = tOperatorService.getById(tSiteDTO.getOperatorId()); |
| | | if (byId1!=null) |
| | | tSiteDTO.setOperator(byId1.getName()); |
| | | } |
| | | } |
| | | } |
| | | return tSiteDTOS; |
| | | } |
| | | |
| | | @Autowired |
| | | private TOperatorService tOperatorService; |
| | | |
| | | @Autowired |
| | | private TOperatorCityService operatorCityService; |
| | | /** |
| | | * 跳转到添加场地管理 |
| | | */ |
| | | @RequestMapping("/add") |
| | | public String tCompetitionAdd(Model model) { |
| | | List<CityManager> province = cityManagerClient.listAll(); |
| | | // 已有城市管理的省 |
| | | ArrayList<String> list1 = new ArrayList<>(); |
| | | // 已有城市管理的市 |
| | | ArrayList<String> list2 = new ArrayList<>(); |
| | | for (CityManager cityManager : province) { |
| | | list1.add(cityManager.getProvince()); |
| | | list2.add(cityManager.getCity()); |
| | | if (UserExt.getUser().getObjectType()==2){ |
| | | // 查询这个运营商管理的省 |
| | | TOperator id = tOperatorService.getOne(new QueryWrapper<TOperator>().eq("id", UserExt.getUser().getObjectId())); |
| | | if (id.getType()==1){ |
| | | // 全国 |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | }else{ |
| | | // 找到他管理的省 |
| | | List<TOperatorCity> list = operatorCityService.list(new QueryWrapper<TOperatorCity>().eq("operatorId", UserExt.getUser().getObjectId()).eq("pid", 0)); |
| | | model.addAttribute("list",list); |
| | | } |
| | | }else{ |
| | | List<TCity> list = cityService.list(new LambdaQueryWrapper<TCity>().eq(TCity::getParentId, 0)); |
| | | model.addAttribute("list",list); |
| | | } |
| | | Integer objectType = UserExt.getUser().getObjectType(); |
| | | Integer objectId = UserExt.getUser().getObjectId(); |
| | | List<Store> stores = new ArrayList<>(); |
| | | if (objectType ==2 ){ |
| | | stores= storeClient.getStoreByCityManagerId(objectId); |
| | | List<TStore> operatorId = storeService.list(new QueryWrapper<TStore>().eq("operatorId", objectId)); |
| | | model.addAttribute("stores",operatorId); |
| | | }else if(objectType == 3){ |
| | | stores= storeClient.getStoreByStoreStaffId(objectId);; |
| | | List<TStore> list = storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getId, objectId)); |
| | | model.addAttribute("stores",list); |
| | | }else { |
| | | model.addAttribute("stores",storeService.list(new QueryWrapper<TStore>().eq("operatorId", 0))); |
| | | } |
| | | List<TOperator> list = tOperatorService.list(); |
| | | model.addAttribute("yysList",list); |
| | | model.addAttribute("userType",objectType); |
| | | HashSet<String> set = new HashSet<String>(list1); |
| | | QueryWrapper<TSiteType> wrapper = new QueryWrapper<>(); |
| | | wrapper.eq("state",1); |
| | | List<TSiteType> siteType = siteTypeService.list(wrapper); |
| | | model.addAttribute("siteType",siteType); |
| | | model.addAttribute("province",set); |
| | | model.addAttribute("city",list2); |
| | | model.addAttribute("province",list); |
| | | String roleid = UserExt.getUser().getRoleid(); |
| | | model.addAttribute("role",roleid); |
| | | model.addAttribute("objectType",objectType); |
| | | model.addAttribute("objectId",objectId); |
| | | model.addAttribute("stores",stores); |
| | | return PREFIX + "tSite_add.html"; |
| | | |
| | | return PREFIX + "TSite_add.html"; |
| | | |
| | | } |
| | | |
| | | // /** |
| | |
| | | @ResponseBody |
| | | public Object getChangeOne(Integer oneId) { |
| | | try { |
| | | return storeService.list(new LambdaQueryWrapper<TStore>().eq(TStore::getOperatorId,oneId).eq(TStore::getState,1)); |
| | | return storeService.list(new QueryWrapper<TStore>() |
| | | .eq("operatorId",oneId) |
| | | .eq("state",1)); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| | | return ERROR; |