import cn.hutool.core.convert.Convert; import cn.hutool.core.util.RandomUtil; import com.xzx.gc.common.Result; import com.xzx.gc.common.constant.Constants; import com.xzx.gc.common.dto.gdmap.CreateFenceDto; import com.xzx.gc.common.dto.gdmap.GdGEODto; import com.xzx.gc.common.dto.gdmap.GdPOIDto; import com.xzx.gc.common.utils.gdmap.GdMapUtil; import com.xzx.gc.entity.AddressInfo; import org.junit.Test; /** * 围栏测试 */ public class FenceTest { @Test public void deleteFence(){ } @Test public void findFenc(){ // GdMapUtil.findFence(null,""); } @Test public void getLocation(){ GdGEODto gdGEODto=new GdGEODto(); gdGEODto.setCity("长沙市"); gdGEODto.setAddress("水墨林溪(云峰路交汇处与木莲西路交汇处)的天天特价鞋店"); Result locationByAddress = GdMapUtil.getLocationByAddress(gdGEODto); System.out.println(locationByAddress.getData()); gdGEODto.setAddress("水墨林溪(云峰路交汇处与木莲西路交汇处)建行对面良品铺子"); locationByAddress = GdMapUtil.getLocationByAddress(gdGEODto); System.out.println(locationByAddress.getData()); } @Test public void getPOI(){ GdPOIDto gdGEODto=new GdPOIDto(); // if(StrUtil.isNotBlank(addressInfo.getAdcode())){ // gdGEODto.setCity(addressInfo.getAdcode()); // }else if(StrUtil.isNotBlank(addressInfo.getCitycode())){ // gdGEODto.setCity(addressInfo.getCitycode()); // }else{ gdGEODto.setCity(Constants.CHANGSHA_CODE); // } gdGEODto.setKeywords("湖南省长沙市天心区青山小区13栋芙蓉兴盛"); AddressInfo locationByAddress = GdMapUtil.getLocationByPOI(gdGEODto,null); } @Test public void createFenc(){ CreateFenceDto createFenceDto=new CreateFenceDto(); createFenceDto.setName("aa"); createFenceDto.setPoints("112.893938,28.136741;112.898641,28.135615;112.894735,28.134028"); createFenceDto.setValid_time("2054-12-30"); createFenceDto.setRepeat("Mon,Tues,Wed,Thur,Fri,Sat,Sun"); createFenceDto.setTime("00:00,23:59"); // GdMapUtil.createFence(createFenceDto); } @Test public void updateFence(){ String gid="bad11949-8e18-4998-bc05-5bc17d4ef774"; CreateFenceDto createFenceDto=new CreateFenceDto(); createFenceDto.setName("圆形围栏大学城"); // createFenceDto.setPoints("112.893154,28.14613;112.904006,28.146512;112.9007,28.142754"); // createFenceDto.setValid_time("2054-12-30"); // createFenceDto.setRepeat("Mon,Tues,Wed,Thur,Fri,Sat,Sun"); createFenceDto.setTime("00:00,23:59"); // createFenceDto.setEnable(null); createFenceDto.setCenter("112.937054,28.16652"); createFenceDto.setRadius(Convert.toDouble(3000)); // GdMapUtil.updateFence(createFenceDto,gid); // findFenc(); } @Test public void isIn(){ String s=RandomUtil.randomString(14); // GdMapUtil.findFence(null,"tianxinqu"); // GdMapUtil.isInFence("112.896838,28.137962," + DateUtil.currentSeconds(),s); // GdMapUtil.isInFence("112.900484,28.141862," + DateUtil.currentSeconds(),s); } }