iplist=ips.getCountryCityByIp(ip).getString();
11 | // for(String s:iplist){
12 | // System.out.println(s.toString());
13 | // }
14 | return iplist;
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/src/cn/com/webxml/ObjectFactory.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenxianchun/cityview/dd8f03d1a4e2c2ee8c4aa357c907168b9aa2070b/src/cn/com/webxml/ObjectFactory.class
--------------------------------------------------------------------------------
/src/cn/com/webxml/package-info.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenxianchun/cityview/dd8f03d1a4e2c2ee8c4aa357c907168b9aa2070b/src/cn/com/webxml/package-info.class
--------------------------------------------------------------------------------
/src/cn/com/webxml/package-info.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/shenxianchun/cityview/dd8f03d1a4e2c2ee8c4aa357c907168b9aa2070b/src/cn/com/webxml/package-info.java
--------------------------------------------------------------------------------
/src/com/cityview/bloomFilter/SingletonTest.java:
--------------------------------------------------------------------------------
1 | package com.cityview.bloomFilter;
2 |
3 | public class SingletonTest {
4 |
5 | // 定义一个私有构造方法
6 | private SingletonTest() {
7 |
8 | }
9 | //定义一个静态私有变量(不初始化,不使用final关键字,使用volatile保证了多线程访问时instance变量的可见性,避免了instance初始化时其他变量属性还没赋值完时,被另外线程调用)
10 | private static volatile SingletonTest instance;
11 |
12 | //定义一个共有的静态方法,返回该类型实例
13 | public static SingletonTest getIstance() {
14 | // 对象实例化时与否判断(不使用同步代码块,instance不等于null时,直接返回对象,提高运行效率)
15 | if (instance == null) {
16 | //同步代码块(对象未初始化时,使用同步代码块,保证多线程访问时对象在第一次创建后,不再重复被创建)
17 | synchronized (SingletonTest.class) {
18 | //未初始化,则初始instance变量
19 | if (instance == null) {
20 | instance = new SingletonTest();
21 | }
22 | }
23 | }
24 | return instance;
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/com/cityview/controller/AqiController.java:
--------------------------------------------------------------------------------
1 | package com.cityview.controller;
2 |
3 | import java.util.List;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 |
7 | import org.springframework.stereotype.Controller;
8 | import org.springframework.web.bind.annotation.RequestBody;
9 | import org.springframework.web.bind.annotation.RequestMapping;
10 | import org.springframework.web.bind.annotation.ResponseBody;
11 |
12 | import com.cityview.po.Aqiday;
13 | import com.cityview.tool.GetIp;
14 |
15 | import cn.com.webxml.IpTest;
16 |
17 | /**
18 | * Title: AqiController.java</p>
19 | *
Description:测试月全量aqi </p>
20 | *
Copyright:版权 2017</p>
21 | * @author 沈先春
22 | * @date 2017年5月5日
23 | * @version 1.0cityview
24 | */
25 | @Controller
26 | @RequestMapping("/aqi")
27 | public class AqiController {
28 | //请求json串(商品信息),输出json(商品信息)
29 | //@RequestBody将请求的商品信息的json串转成itemsCustom对象
30 | //@ResponseBody将itemsCustom转成json输出
31 | @RequestMapping("/requestJson")
32 | public @ResponseBody Aqiday requestJson(@RequestBody Aqiday aqimonth){
33 | System.out.println("传过来了=======================");
34 | System.out.println(aqimonth.getCityname());
35 | //@ResponseBody将itemsCustom转成json输出
36 | return aqimonth;
37 | }
38 |
39 | //请求key/value,输出json
40 | @RequestMapping("/responseJson")
41 | public @ResponseBody Aqiday responseJson(Aqiday aqimonth){
42 | System.out.println("传过来了=======================");
43 | System.out.println(aqimonth.getCityname());
44 | //@ResponseBody将itemsCustom转成json输出
45 | return aqimonth;
46 | }
47 | @RequestMapping("/responseip")
48 | public @ResponseBody String responseip(HttpServletRequest request){
49 | String ip=new GetIp().getIpAddr(request);
50 | System.out.println("访问者的ip地址为"+ip);
51 | List iplist=IpTest.iptest(ip);
52 | for(String s:iplist){
53 | System.out.println(s.toString());
54 | }
55 | return ip;
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/src/com/cityview/controller/CityController.java:
--------------------------------------------------------------------------------
1 | package com.cityview.controller;
2 |
3 | import java.util.List;
4 |
5 | import javax.servlet.http.HttpServletRequest;
6 | import javax.servlet.http.HttpSession;
7 |
8 | import org.springframework.beans.factory.annotation.Autowired;
9 | import org.springframework.stereotype.Controller;
10 | import org.springframework.web.bind.annotation.RequestBody;
11 | import org.springframework.web.bind.annotation.RequestMapping;
12 | import org.springframework.web.bind.annotation.ResponseBody;
13 |
14 | import com.cityview.po.City;
15 | import com.cityview.service.CityService;
16 | import com.cityview.tool.GetIp;
17 | import com.cityview.tool.IpgetCityname;
18 |
19 | /**
20 | * Title: CityController.java</p>
21 | *
Description:查询城市</p>
22 | *
Copyright:版权 2017</p>
23 | * @author 沈先春
24 | * @date 2017年5月6日
25 | * @version 1.0cityview
26 | */
27 | @Controller
28 | @RequestMapping("/city")
29 | public class CityController {
30 |
31 | //注入CityService
32 | @Autowired
33 | private CityService cityService;
34 |
35 |
36 | /**
37 | * 得到ip地址对应的城市
38 | * @param request
39 | * @return
40 | */
41 | @RequestMapping("/IpgetCityname")
42 | public @ResponseBody String IpgetCityname(HttpServletRequest request,HttpSession session){
43 | String ip=new GetIp().getIpAddr(request);
44 | System.out.println("访问者的ip地址为"+ip);
45 |
46 | String cityname=IpgetCityname.GetAddressByIp("106.3.240.209");
47 |
48 | System.out.println("当前访问者的地址为:"+cityname);
49 |
50 | cityname="北京";
51 |
52 | session.setAttribute("cityname", cityname);
53 | return cityname;
54 | }
55 |
56 |
57 | @RequestMapping("/city")
58 | public @ResponseBody List querycitys() throws Exception{
59 | System.out.println("------省份查询start-----");
60 | List citylist=cityService.findcityList();
61 | System.out.println("------省份查询end-----");
62 | //@ResponseBody将itemsCustom转成json输出
63 | return citylist;
64 | }
65 |
66 | @RequestMapping("/province")
67 | public @ResponseBody List queryprovinces(@RequestBody City city) throws Exception{
68 | System.out.println("------市区查询start-----");
69 | System.out.println(city.getCityname());
70 | List citylist=cityService.findprovinceList(city);
71 | if(citylist.size()==0){
72 | citylist.add(city);
73 | }
74 | System.out.println("------市区查询end-----");
75 | //@ResponseBody将itemsCustom转成json输出
76 | return citylist;
77 | }
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/src/com/cityview/controller/FoodController.java:
--------------------------------------------------------------------------------
1 | package com.cityview.controller;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.RequestBody;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.ResponseBody;
10 |
11 | import com.cityview.po.Food;
12 | import com.cityview.service.FoodService;
13 | import com.cityview.spider.FoodMS;
14 |
15 | /**
16 | * 美食统计
17 | * Title: FoodController.java</p>
18 | *
Description:描述 </p>
19 | *
Copyright:版权 2017</p>
20 | * @author 沈先春
21 | * @date 2017年5月18日
22 | * @version 1.0cityview
23 | */
24 | @Controller
25 | @RequestMapping("/food")
26 | public class FoodController {
27 | @Autowired
28 | private FoodService foodService;
29 |
30 |
31 | /**
32 | * 插入美食数据
33 | * @param food
34 | * @return
35 | * @throws Exception
36 | */
37 | @RequestMapping("/insertFood")
38 | public @ResponseBody String insertFood(@RequestBody Food food)throws Exception{
39 | FoodMS foosMS=new FoodMS();
40 | String cityname=food.getCityname();
41 | if(foodService.findFoodcity(cityname)==0){
42 | List foods=foosMS.getFoods(cityname);
43 | foodService.insertFood(foods);
44 | return "美食插入成功";
45 | }else{
46 |
47 | return "该城市的美食已存在";
48 | }
49 | }
50 |
51 | /**
52 | * 查询美食全部
53 | * @param food
54 | * @return
55 | * @throws Exception
56 | */
57 | @RequestMapping("/findFoodAll")
58 | public @ResponseBody List findFoodAll(@RequestBody Food food)throws Exception{
59 | List foods=foodService.findFoodAll(food.getCityname());
60 | if(foods.size()>0){
61 | return foods;
62 | }else{
63 | return null;
64 | }
65 | }
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/com/cityview/controller/ViewController.java:
--------------------------------------------------------------------------------
1 | package com.cityview.controller;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Controller;
7 | import org.springframework.web.bind.annotation.RequestBody;
8 | import org.springframework.web.bind.annotation.RequestMapping;
9 | import org.springframework.web.bind.annotation.ResponseBody;
10 |
11 | import com.cityview.po.Viewspot;
12 | import com.cityview.service.ViewService;
13 | import com.cityview.spider.ViewSpider;
14 |
15 | /**
16 | * 城市风景管理
17 | * Title: ViewController.java</p>
18 | *
Description:描述 </p>
19 | *
Copyright:版权 2017</p>
20 | * @author 沈先春
21 | * @date 2017年5月18日
22 | * @version 1.0cityview
23 | */
24 | @Controller
25 | @RequestMapping("/view")
26 | public class ViewController {
27 | @Autowired
28 | private ViewService viewService;
29 | /**
30 | * 插入风景数据
31 | * @param food
32 | * @return
33 | * @throws Exception
34 | */
35 | @RequestMapping("/insertView")
36 | public @ResponseBody String insertView(@RequestBody Viewspot viewspot)throws Exception{
37 | ViewSpider viewSpider=new ViewSpider();
38 | String cityname=viewspot.getCityname();
39 | if(viewService.findViewcity(cityname)==0){
40 | List viewspots=viewSpider.getViews(cityname);
41 | viewService.insertView(viewspots);
42 | return "插入成功";
43 | }else{
44 | return "插入失败";
45 | }
46 | }
47 |
48 | /**
49 | * 查询风景全部
50 | * @param food
51 | * @return
52 | * @throws Exception
53 | */
54 | @RequestMapping("/findViewAll")
55 | public @ResponseBody List findViewAll(@RequestBody Viewspot viewspot)throws Exception{
56 | List views=viewService.findViewAll(viewspot.getCityname());
57 | if(views.size()>0){
58 | return views;
59 | }else{
60 | return null;
61 | }
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/src/com/cityview/iptool/HttpsetIp.java:
--------------------------------------------------------------------------------
1 | package com.cityview.iptool;
2 |
3 |
4 | import java.io.BufferedReader;
5 | import java.io.IOException;
6 | import java.io.InputStreamReader;
7 | import java.util.ArrayList;
8 | import java.util.List;
9 | import java.util.Random;
10 |
11 |
12 | /**
13 | * 给出一种代理ip解决方案
14 | */
15 | public class HttpsetIp {
16 | /**
17 | * 设置代理ip
18 | * @throws IOException
19 | */
20 | public static void setProxyIp() {
21 | try {
22 | List ipList = new ArrayList<>();
23 | BufferedReader proxyIpReader = new BufferedReader(new InputStreamReader(HttpsetIp.class.getResourceAsStream("/proxyip.txt")));
24 |
25 | String ip = "";
26 | while((ip = proxyIpReader.readLine()) != null) {
27 | ipList.add(ip);
28 | }
29 |
30 | Random random = new Random();
31 | int randomInt = random.nextInt(ipList.size());
32 | String ipport = ipList.get(randomInt);
33 | String proxyIp = ipport.substring(0, ipport.lastIndexOf(":"));
34 | String proxyPort = ipport.substring(ipport.lastIndexOf(":") + 1, ipport.length());
35 |
36 | System.setProperty("http.maxRedirects", "50");
37 | System.getProperties().setProperty("proxySet", "true");
38 | System.getProperties().setProperty("http.proxyHost", proxyIp);
39 | System.getProperties().setProperty("http.proxyPort", proxyPort);
40 |
41 | System.out.println("设置代理ip为:" + proxyIp + "端口号为:" + proxyPort);
42 | } catch (Exception e) {
43 | System.out.println("重新设置代理ip");
44 | setProxyIp();
45 | }
46 |
47 |
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/src/com/cityview/iptool/IpGet.java:
--------------------------------------------------------------------------------
1 | package com.cityview.iptool;
2 |
3 | import java.io.IOException;
4 | import java.net.URL;
5 |
6 | import org.jsoup.Connection;
7 | import org.jsoup.Jsoup;
8 | import org.jsoup.nodes.Document;
9 | import org.jsoup.nodes.Element;
10 | import org.jsoup.select.Elements;
11 |
12 | public class IpGet {
13 |
14 | public static void main(String[] args) {
15 | // TODO Auto-generated method stub
16 | String ipurl="http://www.xicidaili.com/";
17 | int a=0;
18 | for(int j=1;j<=10;j++){
19 | String url="http://www.xicidaili.com/nn/"+j;
20 | try {
21 | Document doc=Jsoup.connect(url).userAgent("Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0; BIDUBrowser 2.x)")
22 | .timeout(2000).get();
23 |
24 | Elements iplists=doc.select("table[id='ip_list']>tbody>tr");
25 | for(int i=1;itr");
20 | for(Element tr:tbody){
21 | Elements tds=tr.select("td");
22 | for(Element td:tds){
23 | System.out.println(td.text());
24 | }
25 | System.out.println("------------------------ip分割------------------------");
26 | }
27 |
28 | }
29 | catch (MalformedURLException e) {
30 | // TODO Auto-generated catch block
31 | e.printStackTrace();
32 | }
33 | catch (IOException e) {
34 | // TODO Auto-generated catch block
35 | e.printStackTrace();
36 | }
37 |
38 | }
39 |
40 | }
41 |
--------------------------------------------------------------------------------
/src/com/cityview/iptool/Kxdaili.java:
--------------------------------------------------------------------------------
1 | package com.cityview.iptool;
2 |
3 | import java.io.IOException;
4 | import java.net.URL;
5 |
6 | import org.jsoup.Jsoup;
7 | import org.jsoup.nodes.Document;
8 | import org.jsoup.nodes.Element;
9 | import org.jsoup.select.Elements;
10 |
11 | public class Kxdaili {
12 |
13 | public static void main(String[] args) {
14 | // TODO Auto-generated method stub
15 | String url="http://www.kxdaili.com/dailiip/1/1.html#ip";
16 | try {
17 | Document doc=Jsoup.parse(new URL(url), 2000);
18 | Elements trs=doc.select("tbody>tr");
19 | for(Element tr:trs){
20 | Elements tds=tr.select("td");
21 | for(Element td:tds){
22 | System.out.println(td.text());
23 | }
24 | System.out.println("-----------------ip分割----------------------------");
25 | }
26 |
27 |
28 | }
29 | catch (IOException e) {
30 | // TODO Auto-generated catch block
31 | e.printStackTrace();
32 | }
33 |
34 |
35 | }
36 |
37 | }
38 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/AqimonthMapper.java:
--------------------------------------------------------------------------------
1 | package com.cityview.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Aqiday;
6 | import com.cityview.po.AqidayCustom;
7 | import com.cityview.po.Aqimonth;
8 | import com.cityview.po.AqimonthCustom;
9 | import com.cityview.po.AqimonthQueryVo;
10 |
11 | /**
12 | * Title: AqimonthMapperCustom.java</p>
13 | *
Description:描述 </p>
14 | *
Copyright:版权 2017</p>
15 | * @author 沈先春
16 | * @date 2017年4月26日
17 | * @version 1.0
18 | */
19 | public interface AqimonthMapper {
20 |
21 | /**查询月全量
22 | * @param aqimonth
23 | * @return
24 | * @throws Exception
25 | */
26 | public List findAqimonthList(Aqimonth aqimonth)throws Exception;
27 |
28 | /**
29 | * 批量插入月全量空气质量指数
30 | * @param aqimonth
31 | * @throws Exception
32 | */
33 | public void insertAqimonthList(List aqimonth)throws Exception;
34 |
35 | /**根据链接查询总数以确定该链接是否在数据库中存在
36 | * @param aqiurl
37 | * @return
38 | * @throws Exception
39 | */
40 | public int findAqi(String aqiurl)throws Exception;
41 |
42 | /**插入日全量空气质量指数
43 | * @param aqidays
44 | * @throws Exception
45 | */
46 | public void insertAqidayList(List aqidays)throws Exception;
47 |
48 | /**查询当月日全量
49 | * @param aqiday
50 | * @return
51 | * @throws Exception
52 | */
53 | public List findaqidayList(Aqiday aqiday)throws Exception;
54 |
55 | /**
56 | * 根据传入的cityname和月份
57 | * @param aqiday
58 | * @return 返回统计对应的天气状况及对应的总天数
59 | * @throws Exception
60 | */
61 | public List findCountGrade(Aqiday aqiday)throws Exception;
62 |
63 | /**
64 | * 根据传入的城市统计每个月质量等级的天数
65 | * @return
66 | * @throws Exception
67 | */
68 | public List findAqiMonthCountGrade(AqimonthCustom aqimonthCustom)throws Exception;
69 |
70 |
71 | /**
72 | * 统计历史以来不同空气质量的天数
73 | * @param aqiday
74 | * @return
75 | * @throws Exception
76 | */
77 | public List findCountGradeDay(Aqiday aqiday)throws Exception;
78 |
79 | /**查询质量等级不同的月数
80 | * @param aqimonth
81 | * @return
82 | * @throws Exception
83 | */
84 | public ListfindCountGradeMonth(Aqimonth aqimonth)throws Exception;
85 |
86 | }
87 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/CityMapper.java:
--------------------------------------------------------------------------------
1 | package com.cityview.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.City;
6 |
7 | public interface CityMapper {
8 | //查询所有省份
9 | public List findcityList()throws Exception;
10 | //根据省份查询市区
11 | public List findprovinceList(City city)throws Exception;
12 | }
13 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/CityMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
9 |
13 |
14 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/FoodMapper.java:
--------------------------------------------------------------------------------
1 | package com.cityview.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Food;
6 |
7 | /**
8 | * Title: FoodMapper.java</p>
9 | *
Description:描述 :美食</p>
10 | *
Copyright:版权 2017</p>
11 | * @author 沈先春
12 | * @date 2017年5月15日
13 | * @version 1.0cityview
14 | */
15 | public interface FoodMapper {
16 | /**
17 | * 批量插入美食
18 | * @param foods
19 | * @throws Exception
20 | */
21 | public void insertFood(List foods)throws Exception;
22 |
23 | /**
24 | * 查找对应的城市美食在数据库中是否存在
25 | * @param cityname
26 | * @return
27 | */
28 | public int findFoodcity(String cityname)throws Exception;
29 |
30 | /**
31 | * 查找对应城市的全部美食
32 | * @param cityname
33 | * @return
34 | * @throws Exception
35 | */
36 | public List findFoodAll(String cityname)throws Exception;
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/FoodMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 | SELECT LAST_INSERT_ID()
11 |
12 | INSERT INTO food(cityname,title,heat,foodurl,imageurl,introduction,create_time)
13 | VALUES
14 |
15 | (#{foodList.cityname},#{foodList.title},#{foodList.heat},
16 | #{foodList.foodurl},#{foodList.imageurl},#{foodList.introduction},NOW())
17 |
18 |
19 |
20 |
21 |
22 |
25 |
26 |
27 |
28 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/HousesMapper.java:
--------------------------------------------------------------------------------
1 | package com.cityview.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Houses;
6 | import com.cityview.po.Job;
7 |
8 | /**
9 | * 房租信息mapper
10 | * Title: HousesMapper.java</p>
11 | *
Description:描述 </p>
12 | *
Copyright:版权 2017</p>
13 | * @author 沈先春
14 | * @date 2017年5月23日
15 | * @version 1.0cityview
16 | */
17 | public interface HousesMapper {
18 |
19 | /**
20 | * 插入房租信息
21 | * @param houses
22 | * @throws Exception
23 | */
24 | public void insertHouseslist(List houses)throws Exception;
25 |
26 | /**
27 | * 统计房子的朝向和价格的关系
28 | * @param cityname
29 | * @return
30 | * @throws Exception
31 | */
32 | public List findFaceprice(String cityname)throws Exception;
33 |
34 | /**
35 | * 统计房子的装修风格和价格的关系
36 | * @param cityname
37 | * @return
38 | * @throws Exception
39 | */
40 | public List findFaceRenovation(String cityname)throws Exception;
41 |
42 | /**
43 | * 统计房屋的中介公司
44 | * @param cityname
45 | * @return
46 | * @throws Exception
47 | */
48 | public List findAgencytotal(String cityname)throws Exception;
49 |
50 | /**
51 | * 统计区域哪块租房最贵
52 | * @param cityname
53 | * @return
54 | * @throws Exception
55 | */
56 | public List findAreaPrice(String cityname)throws Exception;
57 |
58 | /**
59 | * 统计不同户型的价格关系
60 | * @param cityname
61 | * @return
62 | * @throws Exception
63 | */
64 | public List findTypePrice(String cityname)throws Exception;
65 |
66 |
67 | }
68 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/JobMapper.java:
--------------------------------------------------------------------------------
1 | package com.cityview.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Job;
6 |
7 | /**
8 | * 招聘职位mapper
9 | * Title: JobMapper.java</p>
10 | *
Description:描述 </p>
11 | *
Copyright:版权 2017</p>
12 | * @author 沈先春
13 | * @date 2017年5月19日
14 | * @version 1.0cityview
15 | */
16 | public interface JobMapper {
17 | /**
18 | * 插入职位信息
19 | * @throws Exception
20 | */
21 | public void insertJoblist(List jobs)throws Exception;
22 |
23 | /**
24 | * 统计公司不同公司类型的总数
25 | * @param cityname
26 | * @return
27 | * @throws Exception
28 | */
29 | public List findCompanynatureTotal(String cityname)throws Exception;
30 |
31 | /**
32 | * 统计不同规模的公司的数目
33 | * @param cityname
34 | * @return
35 | * @throws Exception
36 | */
37 | public List findScaleTotal(String cityname)throws Exception;
38 |
39 | /**
40 | * 统计不同行业公司的数量
41 | * @param cityname
42 | * @return
43 | * @throws Exception
44 | */
45 | public List findindustry(String cityname)throws Exception;
46 |
47 | /**
48 | * 统计工作经验与工资的关系
49 | * @param cityname
50 | * @return
51 | * @throws Exception
52 | */
53 | public List findpriceExp(Job job)throws Exception;
54 |
55 | /**
56 | * 统计学历与工资的关系
57 | * @param cityname
58 | * @return
59 | * @throws Exception
60 | */
61 | public List findpriceEducation(Job job)throws Exception;
62 |
63 | /**
64 | * 统计工作经验和用人需求的关系
65 | * @param cityname
66 | * @return
67 | * @throws Exception
68 | */
69 | public List finddemandExp(Job job)throws Exception;
70 |
71 | /**
72 | * 学历与用人需求的关系
73 | * @param cityname
74 | * @return
75 | * @throws Exception
76 | */
77 | public List finddemandEducation(Job job)throws Exception;
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/ViewMapper.java:
--------------------------------------------------------------------------------
1 | package com.cityview.mapper;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Food;
6 | import com.cityview.po.Viewspot;
7 |
8 | /**
9 | * 城市风景mapper
10 | * Title: ViewMapper.java</p>
11 | *
Description:描述 </p>
12 | *
Copyright:版权 2017</p>
13 | * @author 沈先春
14 | * @date 2017年5月18日
15 | * @version 1.0cityview
16 | */
17 | public interface ViewMapper {
18 | /**
19 | * 批量插入风景
20 | * @param foods
21 | * @throws Exception
22 | */
23 | public void insertView(List Viewspots)throws Exception;
24 |
25 | /**
26 | * 查找对应的城市风景在数据库中是否存在
27 | * @param cityname
28 | * @return
29 | */
30 | public int findViewcity(String cityname)throws Exception;
31 |
32 | /**
33 | * 查找对应城市的全部风景
34 | * @param cityname
35 | * @return
36 | * @throws Exception
37 | */
38 | public List findViewAll(String cityname)throws Exception;
39 | }
40 |
--------------------------------------------------------------------------------
/src/com/cityview/mapper/ViewMapper.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 |
9 |
10 | SELECT LAST_INSERT_ID()
11 |
12 | INSERT INTO viewspot(cityname,title,peoplenum,viewurl,imageurl,introduction,price,create_time)
13 | VALUES
14 |
15 | (#{viewList.cityname},#{viewList.title},#{viewList.peoplenum},
16 | #{viewList.viewurl},#{viewList.imageurl},#{viewList.introduction},
17 | #{viewList.price},NOW())
18 |
19 |
20 |
21 |
22 |
23 |
26 |
27 |
28 |
29 |
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/src/com/cityview/po/AqidayCustom.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | public class AqidayCustom extends Aqiday{
4 | private String numGrade;//存放统计结果
5 | /**
6 | * @return the numGrade
7 | */
8 | public String getNumGrade() {
9 | return numGrade;
10 | }
11 |
12 | /**
13 | * @param numGrade the numGrade to set
14 | */
15 | public void setNumGrade(String numGrade) {
16 | this.numGrade = numGrade;
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/src/com/cityview/po/AqimonthCustom.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | public class AqimonthCustom extends Aqimonth{
4 | private String numGrade;
5 | /**
6 | * @return the numGrade
7 | */
8 | public String getNumGrade() {
9 | return numGrade;
10 | }
11 | /**
12 | * @param numGrade the numGrade to set
13 | */
14 | public void setNumGrade(String numGrade) {
15 | this.numGrade = numGrade;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/com/cityview/po/AqimonthQueryVo.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | import java.util.List;
4 |
5 | public class AqimonthQueryVo {
6 |
7 | private String monthday;
8 |
9 | private List aqimonthCustoms;
10 |
11 | /**
12 | * @return the monthday
13 | */
14 | public String getMonthday() {
15 | return monthday;
16 | }
17 | /**
18 | * @param monthday the monthday to set
19 | */
20 | public void setMonthday(String monthday) {
21 | this.monthday = monthday;
22 | }
23 | /**
24 | * @return the aqimonthCustoms
25 | */
26 | public List getAqimonthCustoms() {
27 | return aqimonthCustoms;
28 | }
29 | /**
30 | * @param aqimonthCustoms the aqimonthCustoms to set
31 | */
32 | public void setAqimonthCustoms(List aqimonthCustoms) {
33 | this.aqimonthCustoms = aqimonthCustoms;
34 | }
35 |
36 | }
37 |
--------------------------------------------------------------------------------
/src/com/cityview/po/City.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | public class City {
4 | private Integer id;
5 |
6 | private Integer parentId;
7 |
8 | private String cityname;
9 |
10 | private Integer sort;
11 |
12 | public Integer getId() {
13 | return id;
14 | }
15 |
16 | public void setId(Integer id) {
17 | this.id = id;
18 | }
19 |
20 | public Integer getParentId() {
21 | return parentId;
22 | }
23 |
24 | public void setParentId(Integer parentId) {
25 | this.parentId = parentId;
26 | }
27 |
28 | /**
29 | * @return the cityname
30 | */
31 | public String getCityname() {
32 | return cityname;
33 | }
34 |
35 | /**
36 | * @param cityname the cityname to set
37 | */
38 | public void setCityname(String cityname) {
39 | this.cityname = cityname;
40 | }
41 |
42 | public Integer getSort() {
43 | return sort;
44 | }
45 |
46 | public void setSort(Integer sort) {
47 | this.sort = sort;
48 | }
49 | }
--------------------------------------------------------------------------------
/src/com/cityview/po/Food.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | import java.util.Date;
4 |
5 | public class Food {
6 | private Integer id;
7 |
8 | private String cityname;
9 |
10 | private String title;
11 |
12 | private String heat;
13 |
14 | private String foodurl;
15 |
16 | private String imageurl;
17 |
18 | private String introduction;
19 |
20 | private Date createTime;
21 |
22 | public Integer getId() {
23 | return id;
24 | }
25 |
26 | public void setId(Integer id) {
27 | this.id = id;
28 | }
29 |
30 | public String getCityname() {
31 | return cityname;
32 | }
33 |
34 | public void setCityname(String cityname) {
35 | this.cityname = cityname == null ? null : cityname.trim();
36 | }
37 |
38 | public String getTitle() {
39 | return title;
40 | }
41 |
42 | public void setTitle(String title) {
43 | this.title = title == null ? null : title.trim();
44 | }
45 |
46 | public String getHeat() {
47 | return heat;
48 | }
49 |
50 | public void setHeat(String heat) {
51 | this.heat = heat == null ? null : heat.trim();
52 | }
53 |
54 |
55 | /**
56 | * @return the foodurl
57 | */
58 | public String getFoodurl() {
59 | return foodurl;
60 | }
61 |
62 | /**
63 | * @param foodurl the foodurl to set
64 | */
65 | public void setFoodurl(String foodurl) {
66 | this.foodurl = foodurl;
67 | }
68 |
69 | public String getImageurl() {
70 | return imageurl;
71 | }
72 |
73 | public void setImageurl(String imageurl) {
74 | this.imageurl = imageurl == null ? null : imageurl.trim();
75 | }
76 |
77 | public String getIntroduction() {
78 | return introduction;
79 | }
80 |
81 | public void setIntroduction(String introduction) {
82 | this.introduction = introduction == null ? null : introduction.trim();
83 | }
84 |
85 | public Date getCreateTime() {
86 | return createTime;
87 | }
88 |
89 | public void setCreateTime(Date createTime) {
90 | this.createTime = createTime;
91 | }
92 | }
--------------------------------------------------------------------------------
/src/com/cityview/po/Proxyip.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | import java.util.Date;
4 |
5 | public class Proxyip {
6 | private Integer id;
7 |
8 | private String ip;
9 |
10 | private String port;
11 |
12 | private String anonymity;
13 |
14 | private String iptype;
15 |
16 | private String support;
17 |
18 | private String position;
19 |
20 | private String responsetime;
21 |
22 | private Date createTime;
23 |
24 | public Integer getId() {
25 | return id;
26 | }
27 |
28 | public void setId(Integer id) {
29 | this.id = id;
30 | }
31 |
32 | public String getIp() {
33 | return ip;
34 | }
35 |
36 | public void setIp(String ip) {
37 | this.ip = ip == null ? null : ip.trim();
38 | }
39 |
40 | public String getPort() {
41 | return port;
42 | }
43 |
44 | public void setPort(String port) {
45 | this.port = port == null ? null : port.trim();
46 | }
47 |
48 | public String getAnonymity() {
49 | return anonymity;
50 | }
51 |
52 | public void setAnonymity(String anonymity) {
53 | this.anonymity = anonymity == null ? null : anonymity.trim();
54 | }
55 |
56 | public String getIptype() {
57 | return iptype;
58 | }
59 |
60 | public void setIptype(String iptype) {
61 | this.iptype = iptype == null ? null : iptype.trim();
62 | }
63 |
64 | public String getSupport() {
65 | return support;
66 | }
67 |
68 | public void setSupport(String support) {
69 | this.support = support == null ? null : support.trim();
70 | }
71 |
72 | public String getPosition() {
73 | return position;
74 | }
75 |
76 | public void setPosition(String position) {
77 | this.position = position == null ? null : position.trim();
78 | }
79 |
80 | public String getResponsetime() {
81 | return responsetime;
82 | }
83 |
84 | public void setResponsetime(String responsetime) {
85 | this.responsetime = responsetime == null ? null : responsetime.trim();
86 | }
87 |
88 | public Date getCreateTime() {
89 | return createTime;
90 | }
91 |
92 | public void setCreateTime(Date createTime) {
93 | this.createTime = createTime;
94 | }
95 | }
--------------------------------------------------------------------------------
/src/com/cityview/po/Weatherurl.java:
--------------------------------------------------------------------------------
1 | package com.cityview.po;
2 |
3 | import java.util.Date;
4 |
5 | public class Weatherurl {
6 | private Integer id;
7 |
8 | private String cityurl;
9 |
10 | private Date createTime;
11 |
12 | public Integer getId() {
13 | return id;
14 | }
15 |
16 | public void setId(Integer id) {
17 | this.id = id;
18 | }
19 |
20 | public String getCityurl() {
21 | return cityurl;
22 | }
23 |
24 | public void setCityurl(String cityurl) {
25 | this.cityurl = cityurl == null ? null : cityurl.trim();
26 | }
27 |
28 | public Date getCreateTime() {
29 | return createTime;
30 | }
31 |
32 | public void setCreateTime(Date createTime) {
33 | this.createTime = createTime;
34 | }
35 | }
--------------------------------------------------------------------------------
/src/com/cityview/service/AqimonthService.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Aqiday;
6 | import com.cityview.po.AqidayCustom;
7 | import com.cityview.po.Aqimonth;
8 | import com.cityview.po.AqimonthCustom;
9 | import com.cityview.po.AqimonthQueryVo;
10 |
11 |
12 | /**
13 | * Title: AqimonthService.java</p>
14 | *
Description:月全量service </p>
15 | *
Copyright:版权 2017</p>
16 | * @author 沈先春
17 | * @date 2017年5月2日
18 | * @version 1.0cityview
19 | */
20 | public interface AqimonthService {
21 | /**查询月全量
22 | * @param aqimonth
23 | * @return
24 | * @throws Exception
25 | */
26 | public List findAqimonthList(Aqimonth aqimonth)throws Exception;
27 |
28 | /**插入月全量空气质量指数
29 | * @param aqimonth
30 | * @throws Exception
31 | */
32 | public void insertAqimonthList(List aqimonth)throws Exception;
33 |
34 | /**根据链接查询总数以确定该链接是否在数据库中存在
35 | * @param aqiurl
36 | * @return
37 | * @throws Exception
38 | */
39 | public int findAqi(String aqiurl)throws Exception;
40 |
41 | /**
42 | * 插入日全量空气质量指数
43 | * @param aqidays
44 | * @throws Exception
45 | */
46 | public void insertAqidayList(List aqidays)throws Exception;
47 |
48 | /**查询当月日全量
49 | * @param aqiday
50 | * @return
51 | * @throws Exception
52 | */
53 | public List findaqidayList(Aqiday aqiday)throws Exception;
54 |
55 | /**
56 | * 根据传入的cityname和月份
57 | * @param aqiday
58 | * @return 返回统计对应的天气状况及对应的总天数
59 | * @throws Exception
60 | */
61 | public List findCountGrade(Aqiday aqiday)throws Exception;
62 |
63 | /**
64 | * 根据传入的城市统计每个月不同质量等级的天数
65 | * @return
66 | * @throws Exception
67 | */
68 | public List findAqiMonthCountGrade(AqimonthCustom aqimonthCustom)throws Exception;
69 |
70 | /**
71 | * 统计历史以来不同质量等级的天数
72 | * @param aqiday
73 | * @return
74 | * @throws Exception
75 | */
76 | public List findCountGradeDay(Aqiday aqiday)throws Exception;
77 |
78 | /**查询质量等级不同的月数
79 | * @param aqimonth
80 | * @return
81 | * @throws Exception
82 | */
83 | public List findCountGradeMonth(Aqimonth aqimonth)throws Exception;
84 | }
85 |
--------------------------------------------------------------------------------
/src/com/cityview/service/CityService.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.City;
6 |
7 | public interface CityService {
8 | //查询所有省份
9 | public List findcityList()throws Exception;
10 | //根据省份查询市区
11 | public List findprovinceList(City city)throws Exception;
12 | }
13 |
--------------------------------------------------------------------------------
/src/com/cityview/service/FoodService.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Food;
6 |
7 | /**
8 | * 美食Service
9 | * Title: FoodService.java</p>
10 | *
Description:描述 </p>
11 | *
Copyright:版权 2017</p>
12 | * @author 沈先春
13 | * @date 2017年5月18日
14 | * @version 1.0cityview
15 | */
16 | public interface FoodService {
17 | /**
18 | * 批量插入美食
19 | * @param foods
20 | * @throws Exception
21 | */
22 | public void insertFood(List foods)throws Exception;
23 |
24 | /**
25 | * 查找对应的城市美食在数据库中是否存在
26 | * @param cityname
27 | * @return
28 | */
29 | public int findFoodcity(String cityname)throws Exception ;
30 |
31 | /**
32 | * 查找对应城市的全部美食
33 | * @param cityname
34 | * @return
35 | * @throws Exception
36 | */
37 | public List findFoodAll(String cityname)throws Exception;
38 | }
39 |
--------------------------------------------------------------------------------
/src/com/cityview/service/HousesService.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Houses;
6 |
7 | /**
8 | * Title: HousesService.java</p>
9 | *
Description:描述:房租service </p>
10 | *
Copyright:版权 2017</p>
11 | * @author 沈先春
12 | * @date 2017年5月23日
13 | * @version 1.0cityview
14 | */
15 | public interface HousesService {
16 | /**
17 | * 插入房租信息
18 | * @param houses
19 | * @throws Exception
20 | */
21 | public void insertHouseslist(List houses)throws Exception;
22 |
23 | /**
24 | * 统计房子的朝向和价格的关系
25 | * @param cityname
26 | * @return
27 | * @throws Exception
28 | */
29 | public List findFaceprice(String cityname)throws Exception;
30 |
31 | /**
32 | * 统计房子的装修风格和价格的关系
33 | * @param cityname
34 | * @return
35 | * @throws Exception
36 | */
37 | public List findFaceRenovation(String cityname)throws Exception;
38 |
39 | /**
40 | * 统计房屋的中介公司
41 | * @param cityname
42 | * @return
43 | * @throws Exception
44 | */
45 | public List findAgencytotal(String cityname)throws Exception;
46 |
47 | /**
48 | * 统计区域哪块租房最贵
49 | * @param cityname
50 | * @return
51 | * @throws Exception
52 | */
53 | public List findAreaPrice(String cityname)throws Exception;
54 |
55 | /**
56 | * 统计不同户型的价格关系
57 | * @param cityname
58 | * @return
59 | * @throws Exception
60 | */
61 | public List findTypePrice(String cityname)throws Exception;
62 |
63 |
64 | }
65 |
--------------------------------------------------------------------------------
/src/com/cityview/service/JobService.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Job;
6 |
7 | /**
8 | * Title: JobService.java</p>
9 | *
Description:描述:招聘职位service </p>
10 | *
Copyright:版权 2017</p>
11 | * @author 沈先春
12 | * @date 2017年5月19日
13 | * @version 1.0cityview
14 | */
15 | public interface JobService {
16 | /**
17 | * 插入职位信息
18 | * @throws Exception
19 | */
20 | public void insertJoblist(List jobs)throws Exception;
21 |
22 | /**
23 | * 统计公司不同公司类型的总数
24 | * @param cityname
25 | * @return
26 | * @throws Exception
27 | */
28 | public List findCompanynatureTotal(String cityname)throws Exception;
29 |
30 | /**
31 | * 统计不同规模的公司的数目
32 | * @param cityname
33 | * @return
34 | * @throws Exception
35 | */
36 | public List findScaleTotal(String cityname)throws Exception;
37 |
38 | /**
39 | * 统计不同行业公司的数量
40 | * @param cityname
41 | * @return
42 | * @throws Exception
43 | */
44 | public List findindustry(String cityname)throws Exception;
45 |
46 | /**
47 | * 统计工作经验与工资的关系
48 | * @param cityname
49 | * @return
50 | * @throws Exception
51 | */
52 | public List findpriceExp(Job job)throws Exception;
53 |
54 | /**
55 | * 统计学历与工资的关系
56 | * @param cityname
57 | * @return
58 | * @throws Exception
59 | */
60 | public List findpriceEducation(Job job)throws Exception;
61 |
62 | /**
63 | * 统计工作经验和用人需求的关系
64 | * @param cityname
65 | * @return
66 | * @throws Exception
67 | */
68 | public List finddemandExp(Job job)throws Exception;
69 |
70 | /**
71 | * 学历与用人需求的关系
72 | * @param cityname
73 | * @return
74 | * @throws Exception
75 | */
76 | public List finddemandEducation(Job job)throws Exception;
77 |
78 |
79 | }
80 |
--------------------------------------------------------------------------------
/src/com/cityview/service/ViewService.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service;
2 |
3 | import java.util.List;
4 |
5 | import com.cityview.po.Viewspot;
6 |
7 | /**
8 | * 城市风景service
9 | * Title: ViewService.java</p>
10 | *
Description:描述 </p>
11 | *
Copyright:版权 2017</p>
12 | * @author 沈先春
13 | * @date 2017年5月18日
14 | * @version 1.0cityview
15 | */
16 | public interface ViewService {
17 | /**
18 | * 批量插入风景
19 | * @param foods
20 | * @throws Exception
21 | */
22 | public void insertView(List Viewspots)throws Exception;
23 |
24 | /**
25 | * 查找对应的城市风景在数据库中是否存在
26 | * @param cityname
27 | * @return
28 | */
29 | public int findViewcity(String cityname)throws Exception;
30 |
31 | /**
32 | * 查找对应城市的全部风景
33 | * @param cityname
34 | * @return
35 | * @throws Exception
36 | */
37 | public List findViewAll(String cityname)throws Exception;
38 | }
39 |
--------------------------------------------------------------------------------
/src/com/cityview/service/impl/CityServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 |
7 | import com.cityview.mapper.CityMapper;
8 | import com.cityview.po.City;
9 | import com.cityview.service.CityService;
10 |
11 | public class CityServiceImpl implements CityService {
12 |
13 | @Autowired
14 | private CityMapper cityMapper;
15 |
16 | @Override
17 | public List findcityList() throws Exception {
18 | //通过cityMapper查询数据库
19 | return cityMapper.findcityList();
20 | }
21 |
22 | @Override
23 | public List findprovinceList(City cityname) throws Exception {
24 | //通过cityMapper查询数据库
25 | return cityMapper.findprovinceList(cityname);
26 | }
27 |
28 | }
29 |
--------------------------------------------------------------------------------
/src/com/cityview/service/impl/FoodServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 |
7 | import com.cityview.mapper.FoodMapper;
8 | import com.cityview.po.Food;
9 | import com.cityview.service.FoodService;
10 |
11 | public class FoodServiceImpl implements FoodService {
12 |
13 | @Autowired
14 | private FoodMapper foodMapper;
15 |
16 | @Override
17 | public void insertFood(List foods) throws Exception {
18 | // TODO Auto-generated method stub
19 | foodMapper.insertFood(foods);
20 | }
21 |
22 | @Override
23 | public int findFoodcity(String cityname) throws Exception {
24 | // TODO Auto-generated method stub
25 | return foodMapper.findFoodcity(cityname);
26 | }
27 |
28 | @Override
29 | public List findFoodAll(String cityname) throws Exception {
30 | // TODO Auto-generated method stub
31 | return foodMapper.findFoodAll(cityname);
32 | }
33 |
34 | }
35 |
--------------------------------------------------------------------------------
/src/com/cityview/service/impl/HousesServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 |
7 | import com.cityview.mapper.HousesMapper;
8 | import com.cityview.po.Houses;
9 | import com.cityview.service.HousesService;
10 |
11 | public class HousesServiceImpl implements HousesService {
12 | @Autowired
13 | private HousesMapper housesMapper;
14 |
15 | @Override
16 | public void insertHouseslist(List houses) throws Exception {
17 | // TODO Auto-generated method stub
18 | housesMapper.insertHouseslist(houses);
19 | }
20 |
21 | @Override
22 | public List findFaceprice(String cityname) throws Exception {
23 | // TODO Auto-generated method stub
24 | return housesMapper.findFaceprice(cityname);
25 | }
26 |
27 | @Override
28 | public List findFaceRenovation(String cityname) throws Exception {
29 | // TODO Auto-generated method stub
30 | return housesMapper.findFaceRenovation(cityname);
31 | }
32 |
33 | @Override
34 | public List findAgencytotal(String cityname) throws Exception {
35 | // TODO Auto-generated method stub
36 | return housesMapper.findAgencytotal(cityname);
37 | }
38 |
39 | @Override
40 | public List findAreaPrice(String cityname) throws Exception {
41 | // TODO Auto-generated method stub
42 | return housesMapper.findAreaPrice(cityname);
43 | }
44 |
45 | @Override
46 | public List findTypePrice(String cityname) throws Exception {
47 | // TODO Auto-generated method stub
48 | return housesMapper.findTypePrice(cityname);
49 | }
50 |
51 | }
52 |
--------------------------------------------------------------------------------
/src/com/cityview/service/impl/JobServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 |
7 | import com.cityview.mapper.JobMapper;
8 | import com.cityview.po.Job;
9 | import com.cityview.service.JobService;
10 |
11 | /**
12 | * Title: JobServiceImpl.java</p>
13 | *
Description:描述 </p>
14 | *
Copyright:版权 2017</p>
15 | * @author 沈先春
16 | * @date 2017年5月19日
17 | * @version 1.0cityview
18 | */
19 | public class JobServiceImpl implements JobService{
20 |
21 | @Autowired
22 | private JobMapper jobMapper;
23 |
24 |
25 | @Override
26 | public void insertJoblist(List jobs) throws Exception {
27 | // TODO Auto-generated method stub
28 | jobMapper.insertJoblist(jobs);
29 | }
30 |
31 |
32 | @Override
33 | public List findCompanynatureTotal(String cityname) throws Exception {
34 | // TODO Auto-generated method stub
35 | return jobMapper.findCompanynatureTotal(cityname);
36 | }
37 |
38 |
39 | @Override
40 | public List findScaleTotal(String cityname) throws Exception {
41 | // TODO Auto-generated method stub
42 | return jobMapper.findScaleTotal(cityname);
43 | }
44 |
45 | @Override
46 | public List findindustry(String cityname) throws Exception {
47 | // TODO Auto-generated method stub
48 | return jobMapper.findindustry(cityname);
49 | }
50 |
51 | @Override
52 | public List findpriceExp(Job job) throws Exception {
53 | // TODO Auto-generated method stub
54 | return jobMapper.findpriceExp(job);
55 | }
56 |
57 |
58 | @Override
59 | public List findpriceEducation(Job job) throws Exception {
60 | // TODO Auto-generated method stub
61 | return jobMapper.findpriceEducation(job);
62 | }
63 |
64 |
65 | @Override
66 | public List finddemandExp(Job job) throws Exception {
67 | // TODO Auto-generated method stub
68 | return jobMapper.finddemandExp(job);
69 | }
70 |
71 |
72 | @Override
73 | public List finddemandEducation(Job job) throws Exception {
74 | // TODO Auto-generated method stub
75 | return jobMapper.finddemandEducation(job);
76 | }
77 |
78 |
79 |
80 |
81 | }
82 |
--------------------------------------------------------------------------------
/src/com/cityview/service/impl/ViewServiceImpl.java:
--------------------------------------------------------------------------------
1 | package com.cityview.service.impl;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 |
7 | import com.cityview.mapper.ViewMapper;
8 | import com.cityview.po.Viewspot;
9 | import com.cityview.service.ViewService;
10 |
11 | /**
12 | * 风景实现类
13 | * Title: ViewServiceImpl.java</p>
14 | *
Description:描述 </p>
15 | *
Copyright:版权 2017</p>
16 | * @author 沈先春
17 | * @date 2017年5月18日
18 | * @version 1.0cityview
19 | */
20 | public class ViewServiceImpl implements ViewService {
21 | @Autowired
22 | private ViewMapper viewMapper;
23 |
24 | @Override
25 | public void insertView(List Viewspots) throws Exception {
26 | // TODO Auto-generated method stub
27 | viewMapper.insertView(Viewspots);
28 | }
29 |
30 | @Override
31 | public int findViewcity(String cityname) throws Exception {
32 | // TODO Auto-generated method stub
33 | return viewMapper.findViewcity(cityname);
34 | }
35 |
36 | @Override
37 | public List findViewAll(String cityname) throws Exception {
38 | // TODO Auto-generated method stub
39 | return viewMapper.findViewAll(cityname);
40 | }
41 |
42 |
43 |
44 | }
45 |
--------------------------------------------------------------------------------
/src/com/cityview/spider/Weather.java:
--------------------------------------------------------------------------------
1 | package com.cityview.spider;
2 |
3 | import java.io.IOException;
4 | import java.net.MalformedURLException;
5 | import java.net.URL;
6 |
7 | import org.jsoup.Jsoup;
8 | import org.jsoup.nodes.Document;
9 | import org.jsoup.nodes.Element;
10 | import org.jsoup.select.Elements;
11 |
12 | /**
13 | * 城市历史天气(网站自己统计好的数据)
14 | * 暂时废弃,不用
15 | * Title: Weather.java</p>
16 | *
Description:描述 </p>
17 | *
Copyright:版权 2017</p>
18 | * @author 沈先春
19 | * @date 2017年5月14日
20 | * @version 1.0cityview
21 | */
22 | public class Weather {
23 | public final static String weatherUrl="http://lishi.tianqi.com/beijing/index.html";//北京历史天气
24 |
25 | public static void main(String[] args){
26 |
27 | Document doc;
28 | try {
29 | doc = Jsoup.parse(new URL(weatherUrl),200);
30 |
31 | Elements tqtj=doc.select("div[class='tqtongji']>p");
32 | System.out.println(tqtj.outerHtml());
33 | System.out.println("天气统计结束=========================");
34 |
35 | Elements fxtj=doc.select("div[class='tqtongji']>ul");
36 | System.out.println(fxtj.size());
37 | for(int i=0;i map=strs(a[k]);
20 | Set set = map.keySet();
21 | Iterator it = set.iterator();
22 | while (it.hasNext()) {
23 | String key = it.next();
24 | String value = map.get(key);
25 | System.out.println("天气:"+key+";一共:"+value+"天");
26 | }
27 | }
28 | }
29 | public static Map strs(String s){
30 | Map map=new HashMap();
31 | StringBuffer sb = new StringBuffer();
32 | StringBuffer key=new StringBuffer();
33 | boolean find = false;
34 | for(int i=0;i= '0' && ch <= '9'){
37 | find = true;
38 | }else{
39 | find = false;
40 | }
41 | if(find){
42 | sb.append(ch);
43 | }else{
44 | if(ch!='天'){
45 | key.append(ch);
46 | }
47 | }
48 | }
49 | if(!"".equals(key.toString())){
50 | map.put(key.toString(), sb.toString());
51 | }
52 | return map;
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/src/com/cityview/tool/GetIp.java:
--------------------------------------------------------------------------------
1 | package com.cityview.tool;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 |
5 | public class GetIp {
6 | public String getIpAddr(HttpServletRequest request) {
7 | String ip = request.getHeader("x-forwarded-for");
8 | if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
9 | ip = request.getHeader("Proxy-Client-IP");
10 | }
11 | if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
12 | ip = request.getHeader("WL-Proxy-Client-IP");
13 | }
14 | if(ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
15 | ip = request.getRemoteAddr();
16 | }
17 | return ip;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/src/com/cityview/tool/ImageDownload.java:
--------------------------------------------------------------------------------
1 | package com.cityview.tool;
2 |
3 | import java.io.File;
4 | import java.io.FileOutputStream;
5 | import java.io.IOException;
6 | import java.io.InputStream;
7 | import java.net.MalformedURLException;
8 | import java.net.URL;
9 | import java.net.URLConnection;
10 |
11 | public class ImageDownload {
12 |
13 | public static String imgname(String imgurl,String filename) throws Exception {
14 | String path=System.getProperty("user.dir").replace('\\','/');
15 | //String imgurl="http://p1.cncnimg.cn/eat/1/1362.jpg";
16 | System.out.println(path);
17 | int index=imgurl.lastIndexOf("/");
18 | String imgname=imgurl.substring(index+1, imgurl.length());
19 |
20 | System.out.println(imgname);
21 |
22 | URL url=new URL(imgurl);
23 |
24 | URLConnection con=url.openConnection();
25 | InputStream in=con.getInputStream();
26 |
27 | File file=new File(path+"/workspace/cityview/WebRoot/"+filename+"/"+imgname);
28 |
29 | FileOutputStream out=new FileOutputStream(file);
30 | int i=0;
31 | while((i=in.read())!=-1){
32 | out.write(i);
33 | }
34 | System.out.println("图片"+imgname+"下载成功");
35 | out.close();
36 | in.close();
37 | return imgname;
38 | }
39 | }
40 |
--------------------------------------------------------------------------------