| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> 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<String, Double> map = GeoUtil.gcj02towgs84(p.getCenterXGd(), p.getCenterYGd());
- p.setCwsLong(map.get("lon"));
- p.setCwsLat(map.get("lat"));
- }
- }
- }
- }
|