|
@@ -1,6 +1,7 @@
|
|
|
package com.boman.web.core.controller;
|
|
|
|
|
|
import com.boman.common.core.utils.StringUtils;
|
|
|
+import com.boman.domain.dto.AjaxResult;
|
|
|
import com.boman.web.core.domain.SysRegion;
|
|
|
import com.boman.web.core.mapper.SysRegionMapper;
|
|
|
import org.jsoup.Jsoup;
|
|
@@ -53,8 +54,8 @@ public class SysRegionController {
|
|
|
String href = a.attr("href"); // 11.html
|
|
|
String name = a.text(); // 浙江省
|
|
|
|
|
|
- Long id = 13L;
|
|
|
- if ("福建省".equals(name)) {
|
|
|
+ Long id = 18L;
|
|
|
+ if ("湖南省".equals(name)) {
|
|
|
SysRegion region = new SysRegion();
|
|
|
region.setId(id);
|
|
|
region.setPid(0L);
|
|
@@ -80,6 +81,14 @@ public class SysRegionController {
|
|
|
System.out.println("结束");
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ @PostMapping("/select")
|
|
|
+ public AjaxResult selectSysRegion(SysRegion sysRegion) throws IOException {
|
|
|
+ return AjaxResult.success(sysRegionMapper.selectSysRegion(sysRegion));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
// 爬取市
|
|
|
private static void getShi(String shiHref, long i) throws IOException {
|
|
|
|
|
@@ -102,7 +111,7 @@ public class SysRegionController {
|
|
|
String name = nametd.select("a").text(); // 衢州市
|
|
|
System.out.println("开始爬取" + name);
|
|
|
|
|
|
- if ("福州市".equals(name) || "厦门市".equals(name)||"莆田市".equals(name)||"三明市".equals(name)||"泉州市".equals(name)) {
|
|
|
+ if ("益阳市".equals(name) || "郴州市".equals(name)||"永州市".equals(name)||"怀化市".equals(name)) {
|
|
|
SysRegion region = new SysRegion();
|
|
|
region.setId(Long.valueOf(code));
|
|
|
region.setPid(i);
|
|
@@ -115,8 +124,6 @@ public class SysRegionController {
|
|
|
regions.add(region);
|
|
|
getQu(href, code);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -150,7 +157,7 @@ public class SysRegionController {
|
|
|
if (StringUtils.isNotBlank(code)){
|
|
|
region.setId(Long.valueOf(code));
|
|
|
}else {
|
|
|
- region.setId(Long.valueOf( cityCode+ UUID.randomUUID()));
|
|
|
+ region.setId(Long.valueOf( cityCode+ "123456"+sort));
|
|
|
}
|
|
|
region.setPid(Long.valueOf(cityCode));
|
|
|
region.setName(name);
|