4310e8fc6583d14cd2b6badb7e37c17eb5eda9da.svn-base 4.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. package cn.com.goldenwater.dcproj.utils;
  2. import cn.com.goldenwater.dcproj.enums.RequestSourceEnum;
  3. import cn.com.goldenwater.dcproj.model.AttAdXBase;
  4. import cn.com.goldenwater.dcproj.model.AttCwsBaseCrrct;
  5. import cn.com.goldenwater.dcproj.model.WrSwsB;
  6. import org.apache.commons.lang3.StringUtils;
  7. import java.util.Map;
  8. public class WrSwsBUtils {
  9. public static void transferGeo(AttAdXBase p){
  10. String src = p.getSrc();
  11. if(StringUtils.isNotBlank(src)) {
  12. if ("PC".equalsIgnoreCase(src)) {
  13. if (p.getLgtdpc() != null && p.getLttdpc() != null) {
  14. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc());
  15. p.setLgtd(map.get("lon"));
  16. p.setLttd(map.get("lat"));
  17. }
  18. } else if ("MOBILE".equalsIgnoreCase(src)) {
  19. if (p.getLgtd() != null && p.getLttd() != null) {
  20. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd());
  21. p.setLgtdpc(map.get("lon"));
  22. p.setLttdpc(map.get("lat"));
  23. }
  24. }
  25. }else{
  26. if (p.getLgtdpc() != null && p.getLttdpc() != null) {
  27. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc());
  28. p.setLgtd(map.get("lon"));
  29. p.setLttd(map.get("lat"));
  30. } else if (p.getLgtd() != null && p.getLttd() != null) {
  31. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd());
  32. p.setLgtdpc(map.get("lon"));
  33. p.setLttdpc(map.get("lat"));
  34. }
  35. }
  36. }
  37. public static void transferGeo(WrSwsB p){
  38. String src = p.getSrc();
  39. if(StringUtils.isNotBlank(src)) {
  40. if ("PC".equalsIgnoreCase(src)) {
  41. if (p.getLgtdpc() != null && p.getLttdpc() != null) {
  42. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc());
  43. p.setLgtd(map.get("lon"));
  44. p.setLttd(map.get("lat"));
  45. }
  46. } else if ("MOBILE".equalsIgnoreCase(src)) {
  47. if (p.getLgtd() != null && p.getLttd() != null) {
  48. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd());
  49. p.setLgtdpc(map.get("lon"));
  50. p.setLttdpc(map.get("lat"));
  51. }
  52. }
  53. }else{
  54. if (p.getLgtdpc() != null && p.getLttdpc() != null) {
  55. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getLgtdpc(), p.getLttdpc());
  56. p.setLgtd(map.get("lon"));
  57. p.setLttd(map.get("lat"));
  58. } else if (p.getLgtd() != null && p.getLttd() != null) {
  59. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getLgtd(), p.getLttd());
  60. p.setLgtdpc(map.get("lon"));
  61. p.setLttdpc(map.get("lat"));
  62. }
  63. }
  64. }
  65. public static void transferGeo(AttCwsBaseCrrct p){
  66. String src = p.getSrc();
  67. if(StringUtils.isNotBlank(src)) {
  68. if (RequestSourceEnum.PC.getValue().equalsIgnoreCase(src)) {
  69. if (p.getCwsLong() != null && p.getCwsLat() != null) {
  70. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getCwsLong(), p.getCwsLat());
  71. p.setCenterXGd(map.get("lon"));
  72. p.setCenterYGd(map.get("lat"));
  73. }
  74. } else if (RequestSourceEnum.MOBILE.getValue().equalsIgnoreCase(src)) {
  75. if (p.getCenterXGd() != null && p.getCenterYGd() != null) {
  76. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getCenterXGd(), p.getCenterYGd());
  77. p.setCwsLong(map.get("lon"));
  78. p.setCwsLat(map.get("lat"));
  79. }
  80. }
  81. }else{
  82. if (p.getCwsLong() != null && p.getCwsLat() != null) {
  83. Map<String, Double> map = GeoUtil.wgs84togcj02(p.getCwsLong(), p.getCwsLat());
  84. p.setCenterXGd(map.get("lon"));
  85. p.setCenterYGd(map.get("lat"));
  86. } else if (p.getCenterXGd() != null && p.getCenterYGd() != null) {
  87. Map<String, Double> map = GeoUtil.gcj02towgs84(p.getCenterXGd(), p.getCenterYGd());
  88. p.setCwsLong(map.get("lon"));
  89. p.setCwsLat(map.get("lat"));
  90. }
  91. }
  92. }
  93. }