src/main/java/cc/mrbird/febs/mall/service/impl/AdminMallTeamLeaderServiceImpl.java
@@ -96,7 +96,7 @@ public FebsResponse leaderUpdate(MallTeamLeader mallTeamLeader) { Long id = mallTeamLeader.getId(); MallTeamLeader mallTeamLeaders = this.baseMapper.selectById(id); if(1 == mallTeamLeader.getOnlineState()){ if(1 == mallTeamLeaders.getOnlineState()){ return new FebsResponse().fail().message("请先让团长离线"); } if(ObjectUtil.isEmpty(mallTeamLeaders)){ @@ -255,6 +255,7 @@ private final XcxProperties xcxProperties = SpringContextHolder.getBean(XcxProperties.class); @Override @Transactional public FebsResponse addFence(AdminLeaderAddFenceDto adminLeaderAddFenceDto) { Long id = adminLeaderAddFenceDto.getId(); MallTeamLeader mallTeamLeader = this.baseMapper.selectById(id); @@ -271,20 +272,22 @@ if("fail".equals(resultStr)){ return new FebsResponse().fail().message("高德地图查询服务失败"); } JSONObject jsonObject = JSONUtil.parseObj(resultStr); String results = jsonObject.get("results").toString(); JSONArray jsonArray = JSONUtil.parseArray(results); for(Object jsonArray1 : jsonArray){ JSONObject jsonObject1 = JSONUtil.parseObj(jsonArray1); String name = jsonObject1.get("name").toString(); String sid = jsonObject1.get("sid").toString(); if(xcxProperties.getServiceName().equals(name)){ serviceId= sid; break; } } if(StrUtil.isBlank(serviceId)){ log.info(resultStr); if("null".equals(resultStr) || StrUtil.isBlank(resultStr)){ serviceId = iMallElectronicFenceService.trackServiceAdd(xcxProperties.getGaodeKey(), xcxProperties.getServiceName()); }else{ JSONObject jsonObject = JSONUtil.parseObj(resultStr); String results = jsonObject.get("results").toString(); JSONArray jsonArray = JSONUtil.parseArray(results); for(Object jsonArray1 : jsonArray){ JSONObject jsonObject1 = JSONUtil.parseObj(jsonArray1); String name = jsonObject1.get("name").toString(); String sid = jsonObject1.get("sid").toString(); if(xcxProperties.getServiceName().equals(name)){ serviceId= sid; break; } } } }else{ serviceId = mallElectronicFences.get(0).getServiceId(); src/main/resources/application-test.yml
@@ -78,5 +78,5 @@ certLocalPath: /home/yyscCert/apiclient_cert.p12 wecharpayMchid: 1631084809 wecharpaySecret: YYSC13875978057YYSC13875978057SH gaodeKey: e024c63342930addc57189c8608cdb01 gaodeKey: 95ede7157929f5f6b6c758971be924b1 serviceName: yiyuanshucai src/test/java/cc/mrbird/febs/ProfitTest.java
@@ -216,8 +216,70 @@ // FebsResponse febsResponse = iXcxPayService.generateQrCode(wxGenerateQrCodeDto); // String data = febsResponse.get("data").toString(); // System.out.println(data); trackServiceInfo("e024c63342930addc57189c8608cdb01",null); // trackServiceInfo("e024c63342930addc57189c8608cdb01",null); // String e024c63342930addc57189c8608cdb01 = trackServiceDel("e024c63342930addc57189c8608cdb01", "792477"); // System.out.println(e024c63342930addc57189c8608cdb01); String ss = fenceDel("95ede7157929f5f6b6c758971be924b1", "795278","798477"); System.out.println(ss); } //电子围栏删除 public String fenceDel(String gaodeKey, String sid,String fenceId) { String url = "https://tsapi.amap.com/v1/track/geofence/delete?key="+gaodeKey+"&sid="+sid+"&gfids="+fenceId; HttpPost httpPost = new HttpPost(url); Map<String,String> map = new HashMap<>(); map.put("key",gaodeKey); map.put("sid",sid); map.put("gfids",fenceId); String param= JSON.toJSONString(map); String result = null; try { result = HttpCurlUtil.sendPostHttp(url, param); } catch (IOException e) { e.printStackTrace(); } cn.hutool.json.JSONObject maps = JSONUtil.parseObj(result); System.out.println(maps); String errcode = maps.get("errcode").toString(); if(!"10000".equals(errcode)){ return "fail"; }else{ return maps.toString(); } } //服务删除 public String trackServiceDel(String gaodeKey, String sid) { String url = "https://tsapi.amap.com/v1/track/service/delete?key="+gaodeKey+"&sid="+sid; HttpPost httpPost = new HttpPost(url); Map<String,String> map = new HashMap<>(); map.put("key",gaodeKey); map.put("sid",sid); String param= JSON.toJSONString(map); String result = null; try { result = HttpCurlUtil.sendPostHttp(url, param); } catch (IOException e) { e.printStackTrace(); } cn.hutool.json.JSONObject maps = JSONUtil.parseObj(result); System.out.println(maps); String errcode = maps.get("errcode").toString(); if(!"10000".equals(errcode)){ return "fail"; }else{ return maps.toString(); } // String str2 = maps.get("data").toString(); // cn.hutool.json.JSONObject maps2 = JSONUtil.parseObj(str2); // String serviceId = maps2.get("sid").toString(); // if(null!=serviceId&&!"".equals(serviceId)){ // return serviceId; // }else{ // return "fail"; // } } public String trackServiceInfo(String gaodeKey, String serviceName) { String url = "https://tsapi.amap.com/v1/track/service/list"; HttpPost httpPost = new HttpPost(url);