Commit c6199641a3a043fde3a51c6454b79f20ba3e36a6
1 parent
5af20537
update...
Showing
3 changed files
with
55 additions
and
0 deletions
src/main/java/com/bsth/data/led_http/LedHttpPushHandler.java
0 → 100644
| 1 | +package com.bsth.data.led_http; | |
| 2 | + | |
| 3 | +import com.bsth.data.utils.HttpClientUtils; | |
| 4 | +import com.bsth.entity.ac.CarInOutEntity; | |
| 5 | +import com.bsth.entity.real.RealCarPark; | |
| 6 | +import com.bsth.util.ConfigUtil; | |
| 7 | +import org.slf4j.Logger; | |
| 8 | + | |
| 9 | +/** | |
| 10 | + * Created by panzhao on 2017/9/26. | |
| 11 | + */ | |
| 12 | +public class LedHttpPushHandler { | |
| 13 | + | |
| 14 | + private static String inUrl; | |
| 15 | + private static String outUrl; | |
| 16 | + | |
| 17 | + static Logger logger = org.slf4j.LoggerFactory.getLogger(LedHttpPushHandler.class); | |
| 18 | + | |
| 19 | + static { | |
| 20 | + inUrl = ConfigUtil.get("led.push.in.url"); | |
| 21 | + outUrl = ConfigUtil.get("led.push.out.url"); | |
| 22 | + } | |
| 23 | + | |
| 24 | + public static void busOut(CarInOutEntity cio){ | |
| 25 | + String jGh = cio.getJsy(); | |
| 26 | + if(jGh.indexOf("/") != -1) | |
| 27 | + jGh = jGh.split("/")[0]; | |
| 28 | + String url = outUrl + "?zbh="+cio.getNbbm()+"&buff="+cio.getType()+"&jsyid="+jGh + "&sjfcsj=" + cio.getT(); | |
| 29 | + | |
| 30 | + try { | |
| 31 | + HttpClientUtils.get(url); | |
| 32 | + } catch (Exception e) { | |
| 33 | + logger.error("", e); | |
| 34 | + } | |
| 35 | + } | |
| 36 | + | |
| 37 | + public static void busIn(RealCarPark rcp){ | |
| 38 | + String url = inUrl + "?cph="+rcp.getNbbm()+"&park="+rcp.getBerthName(); | |
| 39 | + | |
| 40 | + try { | |
| 41 | + HttpClientUtils.get(url); | |
| 42 | + } catch (Exception e) { | |
| 43 | + logger.error("", e); | |
| 44 | + } | |
| 45 | + } | |
| 46 | +} | ... | ... |
src/main/java/com/bsth/data/real_park/CarParkRealHandler.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.real_park; |
| 3 | 3 | import com.bsth.common.ResponseCode; |
| 4 | 4 | import com.bsth.data.basic.bus.BusDataBuffer; |
| 5 | 5 | import com.bsth.data.electric.CarElectricBuffer; |
| 6 | +import com.bsth.data.led_http.LedHttpPushHandler; | |
| 6 | 7 | import com.bsth.entity.Bus; |
| 7 | 8 | import com.bsth.entity.ac.CarInOutEntity; |
| 8 | 9 | import com.bsth.entity.berth.RegionBerth; |
| ... | ... | @@ -140,6 +141,9 @@ public class CarParkRealHandler { |
| 140 | 141 | rcp.setSoc(be.getSoc()); |
| 141 | 142 | |
| 142 | 143 | busRcps.put(nbbm, rcp); |
| 144 | + | |
| 145 | + //push led | |
| 146 | + LedHttpPushHandler.busIn(rcp); | |
| 143 | 147 | } |
| 144 | 148 | |
| 145 | 149 | /** |
| ... | ... | @@ -153,6 +157,7 @@ public class CarParkRealHandler { |
| 153 | 157 | return; |
| 154 | 158 | |
| 155 | 159 | busRcps.remove(nbbm); |
| 160 | + LedHttpPushHandler.busOut(cio); | |
| 156 | 161 | } |
| 157 | 162 | |
| 158 | 163 | /** | ... | ... |
src/main/resources/config.properties
| ... | ... | @@ -17,6 +17,10 @@ data.schedule.inout.url=http://127.0.0.1:9089/webservice/rest/schedule_real |
| 17 | 17 | # 集调接口密码 |
| 18 | 18 | data.password=6DABD12209BEDAB0808CF7DC967EC2B4C6748277 |
| 19 | 19 | |
| 20 | +# 同步屏 | |
| 21 | +led.push.in.url= http://127.0.0.1:8081/get/jcPlan | |
| 22 | +led.push.out.url= http://127.0.0.1:8081/get/pbPlan | |
| 23 | + | |
| 20 | 24 | ## 高科西路 |
| 21 | 25 | tcc.name=高科西路 |
| 22 | 26 | tcc.company.id=55 | ... | ... |