|
@@ -8,6 +8,7 @@ import com.hankcs.hanlp.dictionary.py.Pinyin;
|
|
|
import com.hankcs.hanlp.dictionary.py.PinyinDictionary;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.jsoup.Connection;
|
|
|
import org.jsoup.Jsoup;
|
|
|
import org.jsoup.nodes.Document;
|
|
|
import org.jsoup.nodes.Element;
|
|
@@ -209,11 +210,17 @@ public class WeatherInfoServiceImpl extends ServiceImpl<WeatherInfoMapper, Weath
|
|
|
if (duration.toDays() > 0){
|
|
|
List<WeatherInfo> list = new ArrayList<>();
|
|
|
Map<String, Map<String, String>> weatherMap = null;
|
|
|
+ if (projectContractArea.getCounty().length() <= 1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<Pinyin> py = PinyinDictionary.convertToPinyin(projectContractArea.getCounty().substring(0, projectContractArea.getCounty().length() - 1));
|
|
|
StringBuilder county = new StringBuilder();
|
|
|
for (int i = 0; i < py.size(); i++) {
|
|
|
county.append(py.get(i).getPinyinWithoutTone());
|
|
|
}
|
|
|
+ if (projectContractArea.getCity().length() <= 1){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
List<Pinyin> py2 = PinyinDictionary.convertToPinyin(projectContractArea.getCity().substring(0, projectContractArea.getCity().length() - 1));
|
|
|
StringBuilder city = new StringBuilder();
|
|
|
for (int i = 0; i < py2.size(); i++) {
|
|
@@ -252,7 +259,10 @@ public class WeatherInfoServiceImpl extends ServiceImpl<WeatherInfoMapper, Weath
|
|
|
Map<String,Map<String,String>> map = new HashMap<>();
|
|
|
Document document = null;
|
|
|
try {
|
|
|
- document = Jsoup.connect(html).get();
|
|
|
+ System.out.println(html);
|
|
|
+ Connection connect = Jsoup.connect(html);
|
|
|
+ connect.timeout(20000);
|
|
|
+ document = connect.get();
|
|
|
Element body = document.body();
|
|
|
Elements table = body.getElementsByTag("table");
|
|
|
Elements trs = table.select("tr");
|