From 26bf126507d20d3a98503c475cd37637e026feaa Mon Sep 17 00:00:00 2001
From: tangxiaobao <303826152@qq.com>
Date: 星期三, 21 七月 2021 17:02:29 +0800
Subject: [PATCH] 社区后台基础数据库bug修改

---
 springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWorkGuideServiceImpl.java |  102 +++++++++++++++++++++++----------------------------
 1 files changed, 46 insertions(+), 56 deletions(-)

diff --git a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWorkGuideServiceImpl.java b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWorkGuideServiceImpl.java
index 1577a53..f57b93e 100644
--- a/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWorkGuideServiceImpl.java
+++ b/springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComActWorkGuideServiceImpl.java
@@ -1,6 +1,5 @@
 package com.panzhihua.service_community.service.impl;
 
-import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -17,19 +16,10 @@
 import com.panzhihua.service_community.model.dos.ComActWorkGuideDO;
 import com.panzhihua.service_community.model.dos.ComActWorkGuideMaterialDO;
 import com.panzhihua.service_community.service.ComActWorkGuideService;
-import net.sf.json.xml.XMLSerializer;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.text.DecimalFormat;
-import java.util.ArrayList;
 import java.util.List;
 import java.util.stream.Collectors;
 
@@ -123,11 +113,11 @@
             vo.setAddress(comActDO.getAddress());
             vo.setPhone(comActDO.getContactsPhone());
         }
-        List<String> list = getCoordinate(vo.getAddress());
-        if (list !=null && list.size() > 0){
-            vo.setLon(list.get(0));
-            vo.setLat(list.get(1));
-        }
+//        List<String> list = getCoordinate(vo.getAddress());
+//        if (list !=null && list.size() > 0){
+//            vo.setLon(list.get(0));
+//            vo.setLat(list.get(1));
+//        }
         List<ComActWorkGuideMaterialDO> workGuideMaterialDOS = workGuideMaterialDAO.selectList(new LambdaQueryWrapper<ComActWorkGuideMaterialDO>()
                 .eq(ComActWorkGuideMaterialDO::getWorkGuideId, workGuideId));
         workGuideMaterialDOS.forEach(workGuideMaterialDO -> {
@@ -164,46 +154,46 @@
         return R.ok();
     }
 
-    // 调用百度地图API根据地址,获取坐标
-    public static List<String> getCoordinate(String address) {
-        List<String> list = new ArrayList<>();
-        if (address != null && !"".equals(address)) {
-            address = address.replaceAll("\\s*", "").replace("#", "栋");
-            String url = "http://api.map.baidu.com/geocoder/v3/?address=" + address + "&output=json&ak=" + AK;
-            String json = loadJSON(url);
-//            json = "{" + json;
-//            json = json + "}";
-            if (json != null && !"".equals(json)) {
-                XMLSerializer xmlSerializer = new XMLSerializer();
-                //将xml转为json(注:如果是元素的属性,会在json里的key前加一个@标识)
-                String result = xmlSerializer.read(json).toString();
-                JSONObject obj = JSONObject.parseObject(json);
-                if ("0".equals(obj.getString("status"))) {
-                    double lng = obj.getJSONObject("result").getJSONObject("location").getDouble("lng"); // 经度
-                    double lat = obj.getJSONObject("result").getJSONObject("location").getDouble("lat"); // 纬度
-                    DecimalFormat df = new DecimalFormat("#.######");
-                    list.add(df.format(lng));
-                    list.add(df.format(lat));
-                    return list;
-                }
-            }
-        }
-        return null;
-    }
-
-    public static String loadJSON(String url) {
-        StringBuilder json = new StringBuilder();
-        try {
-            URL oracle = new URL(url);
-            URLConnection yc = oracle.openConnection();
-            BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream(), "UTF-8"));
-            String inputLine = null;
-            while ((inputLine = in.readLine()) != null) {
-                json.append(inputLine);
-            }
-            in.close();
-        } catch (MalformedURLException e) {} catch (IOException e) {}
-        return json.toString();
-    }
+//    // 调用百度地图API根据地址,获取坐标
+//    public static List<String> getCoordinate(String address) {
+//        List<String> list = new ArrayList<>();
+//        if (address != null && !"".equals(address)) {
+//            address = address.replaceAll("\\s*", "").replace("#", "栋");
+//            String url = "http://api.map.baidu.com/geocoder/v3/?address=" + address + "&output=json&ak=" + AK;
+//            String json = loadJSON(url);
+////            json = "{" + json;
+////            json = json + "}";
+//            if (json != null && !"".equals(json)) {
+//                XMLSerializer xmlSerializer = new XMLSerializer();
+//                //将xml转为json(注:如果是元素的属性,会在json里的key前加一个@标识)
+//                String result = xmlSerializer.read(json).toString();
+//                JSONObject obj = JSONObject.parseObject(json);
+//                if ("0".equals(obj.getString("status"))) {
+//                    double lng = obj.getJSONObject("result").getJSONObject("location").getDouble("lng"); // 经度
+//                    double lat = obj.getJSONObject("result").getJSONObject("location").getDouble("lat"); // 纬度
+//                    DecimalFormat df = new DecimalFormat("#.######");
+//                    list.add(df.format(lng));
+//                    list.add(df.format(lat));
+//                    return list;
+//                }
+//            }
+//        }
+//        return null;
+//    }
+//
+//    public static String loadJSON(String url) {
+//        StringBuilder json = new StringBuilder();
+//        try {
+//            URL oracle = new URL(url);
+//            URLConnection yc = oracle.openConnection();
+//            BufferedReader in = new BufferedReader(new InputStreamReader(yc.getInputStream(), "UTF-8"));
+//            String inputLine = null;
+//            while ((inputLine = in.readLine()) != null) {
+//                json.append(inputLine);
+//            }
+//            in.close();
+//        } catch (MalformedURLException e) {} catch (IOException e) {}
+//        return json.toString();
+//    }
 
 }

--
Gitblit v1.7.1