package cn.com.goldenwater.dcproj.utils; import cn.com.goldenwater.dcproj.enums.RequestSourceEnum; import cn.com.goldenwater.dcproj.model.AttAdXBase; import cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct; import cn.com.goldenwater.dcproj.model.WrSwsB; import org.apache.commons.lang3.StringUtils; import java.util.Map; public class WrSwsBUtils { public static void transferGeo(AttAdXBase p){ String src = p.getSrc(); if(StringUtils.isNotBlank(src)) { if ("PC".equalsIgnoreCase(src)) { if (p.getLgtdpc() != null && p.getLttdpc() != null) { Map map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc()); p.setLgtd(map.get("lon")); p.setLttd(map.get("lat")); } } else if ("MOBILE".equalsIgnoreCase(src)) { if (p.getLgtd() != null && p.getLttd() != null) { Map map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd()); p.setLgtdpc(map.get("lon")); p.setLttdpc(map.get("lat")); } } }else{ if (p.getLgtdpc() != null && p.getLttdpc() != null) { Map map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc()); p.setLgtd(map.get("lon")); p.setLttd(map.get("lat")); } else if (p.getLgtd() != null && p.getLttd() != null) { Map map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd()); p.setLgtdpc(map.get("lon")); p.setLttdpc(map.get("lat")); } } } public static void transferGeo(WrSwsB p){ String src = p.getSrc(); if(StringUtils.isNotBlank(src)) { if ("PC".equalsIgnoreCase(src)) { if (p.getLgtdpc() != null && p.getLttdpc() != null) { Map map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc()); p.setLgtd(map.get("lon")); p.setLttd(map.get("lat")); } } else if ("MOBILE".equalsIgnoreCase(src)) { if (p.getLgtd() != null && p.getLttd() != null) { Map map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd()); p.setLgtdpc(map.get("lon")); p.setLttdpc(map.get("lat")); } } }else{ if (p.getLgtdpc() != null && p.getLttdpc() != null) { Map map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc()); p.setLgtd(map.get("lon")); p.setLttd(map.get("lat")); } else if (p.getLgtd() != null && p.getLttd() != null) { Map map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd()); p.setLgtdpc(map.get("lon")); p.setLttdpc(map.get("lat")); } } } public static void transferGeo(AttCwsBaseCrrct p){ String src = p.getSrc(); if(StringUtils.isNotBlank(src)) { if (RequestSourceEnum.PC.getValue().equalsIgnoreCase(src)) { if (p.getCwsLong() != null && p.getCwsLat() != null) { Map map = GeoUtil.wgs84togcj02(p.getCwsLong(), p.getCwsLat()); p.setCenterXGd(map.get("lon")); p.setCenterYGd(map.get("lat")); } } else if (RequestSourceEnum.MOBILE.getValue().equalsIgnoreCase(src)) { if (p.getCenterXGd() != null && p.getCenterYGd() != null) { Map map = GeoUtil.gcj02towgs84(p.getCenterXGd(), p.getCenterYGd()); p.setCwsLong(map.get("lon")); p.setCwsLat(map.get("lat")); } } }else{ if (p.getCwsLong() != null && p.getCwsLat() != null) { Map map = GeoUtil.wgs84togcj02(p.getCwsLong(), p.getCwsLat()); p.setCenterXGd(map.get("lon")); p.setCenterYGd(map.get("lat")); } else if (p.getCenterXGd() != null && p.getCenterYGd() != null) { Map map = GeoUtil.gcj02towgs84(p.getCenterXGd(), p.getCenterYGd()); p.setCwsLong(map.get("lon")); p.setCwsLat(map.get("lat")); } } } }