Commit 6ed3aa69735cfaa84da8f974eae805c4092b31af
1 parent
61f9db5f
接口地址改为数据库获取
Showing
1 changed file
with
5 additions
and
3 deletions
src/main/java/com/bsth/data/zndd/carMonitor.java
| 1 | package com.bsth.data.zndd; | 1 | package com.bsth.data.zndd; |
| 2 | 2 | ||
| 3 | +import com.bsth.service.SystemParamService; | ||
| 3 | import org.apache.commons.io.IOUtils; | 4 | import org.apache.commons.io.IOUtils; |
| 4 | import org.dom4j.Document; | 5 | import org.dom4j.Document; |
| 5 | import org.dom4j.DocumentHelper; | 6 | import org.dom4j.DocumentHelper; |
| 6 | import org.dom4j.Element; | 7 | import org.dom4j.Element; |
| 7 | import org.slf4j.Logger; | 8 | import org.slf4j.Logger; |
| 8 | import org.slf4j.LoggerFactory; | 9 | import org.slf4j.LoggerFactory; |
| 10 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 9 | import org.springframework.stereotype.Component; | 11 | import org.springframework.stereotype.Component; |
| 10 | 12 | ||
| 11 | import java.io.ByteArrayOutputStream; | 13 | import java.io.ByteArrayOutputStream; |
| @@ -20,13 +22,13 @@ import java.util.*; | @@ -20,13 +22,13 @@ import java.util.*; | ||
| 20 | public class carMonitor { | 22 | public class carMonitor { |
| 21 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 23 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 22 | 24 | ||
| 23 | - static String url; | ||
| 24 | - | 25 | + @Autowired |
| 26 | + private SystemParamService systemParamService; | ||
| 25 | 27 | ||
| 26 | public List<Map> carMonitor(String lineCode,String directions,String station) { | 28 | public List<Map> carMonitor(String lineCode,String directions,String station) { |
| 27 | 29 | ||
| 28 | List<Map> list = new ArrayList<>(); //返回的接口数据 | 30 | List<Map> list = new ArrayList<>(); //返回的接口数据 |
| 29 | - url = "http://58.34.52.130:9777/xxfb/jd/carMonitor?lineid="+lineCode+"&stopid="+station+"&direction="+directions; | 31 | + String url = systemParamService.getValue("url.xxfb")+"xxfb/jd/carMonitor?lineid="+lineCode+"&stopid="+station+"&direction="+directions; |
| 30 | InputStream in = null; | 32 | InputStream in = null; |
| 31 | OutputStream out = null; | 33 | OutputStream out = null; |
| 32 | try { | 34 | try { |