Commit b56089fd06f6524f45e04bca0d87864ddcb74b13
Merge branch 'lggj' of http://192.168.168.245:8888/panzhaov5/bsth_control into lggj
Showing
6 changed files
with
169 additions
and
46 deletions
src/main/java/com/bsth/controller/realcontrol/AdminUtilsController.java
| @@ -345,8 +345,7 @@ public class AdminUtilsController { | @@ -345,8 +345,7 @@ public class AdminUtilsController { | ||
| 345 | gatewayHttpLoader.afterPropertiesSet(); | 345 | gatewayHttpLoader.afterPropertiesSet(); |
| 346 | gatewayHttpUtils.afterPropertiesSet(); | 346 | gatewayHttpUtils.afterPropertiesSet(); |
| 347 | rfidHttpLoader.afterPropertiesSet(); | 347 | rfidHttpLoader.afterPropertiesSet(); |
| 348 | - ssoConfig.setSystemCode(SystemParamCache.getSsoSystemCode()); | ||
| 349 | - ssoConfig.setSsoAuthUrl(SystemParamCache.getUrlHttpSsoAuth()); | 348 | + ssoConfig.afterPropertiesSet(); |
| 350 | 349 | ||
| 351 | return "success"; | 350 | return "success"; |
| 352 | } catch (Exception e) { | 351 | } catch (Exception e) { |
| @@ -365,8 +364,7 @@ public class AdminUtilsController { | @@ -365,8 +364,7 @@ public class AdminUtilsController { | ||
| 365 | gatewayHttpLoader.afterPropertiesSet(); | 364 | gatewayHttpLoader.afterPropertiesSet(); |
| 366 | gatewayHttpUtils.afterPropertiesSet(); | 365 | gatewayHttpUtils.afterPropertiesSet(); |
| 367 | rfidHttpLoader.afterPropertiesSet(); | 366 | rfidHttpLoader.afterPropertiesSet(); |
| 368 | - ssoConfig.setSystemCode(SystemParamCache.getSsoSystemCode()); | ||
| 369 | - ssoConfig.setSsoAuthUrl(SystemParamCache.getUrlHttpSsoAuth()); | 367 | + ssoConfig.afterPropertiesSet(); |
| 370 | 368 | ||
| 371 | return "success"; | 369 | return "success"; |
| 372 | } catch (Exception e) { | 370 | } catch (Exception e) { |
src/main/java/com/bsth/data/zndd/AutomaticSch.java
| @@ -5,31 +5,22 @@ import com.alibaba.fastjson.JSONObject; | @@ -5,31 +5,22 @@ import com.alibaba.fastjson.JSONObject; | ||
| 5 | import com.bsth.data.BasicData; | 5 | import com.bsth.data.BasicData; |
| 6 | import com.bsth.data.adjg.domain.LargeGap; | 6 | import com.bsth.data.adjg.domain.LargeGap; |
| 7 | import com.bsth.data.directive.DayOfDirectives; | 7 | import com.bsth.data.directive.DayOfDirectives; |
| 8 | -import com.bsth.data.directive.GatewayHttpUtils; | ||
| 9 | -import com.bsth.data.directive.MsgIdGenerator; | ||
| 10 | import com.bsth.data.gpsdata_v2.GpsRealData; | 8 | import com.bsth.data.gpsdata_v2.GpsRealData; |
| 11 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; | 9 | import com.bsth.data.gpsdata_v2.entity.GpsEntity; |
| 12 | import com.bsth.data.schedule.DayOfSchedule; | 10 | import com.bsth.data.schedule.DayOfSchedule; |
| 13 | import com.bsth.data.schedule.ScheduleComparator; | 11 | import com.bsth.data.schedule.ScheduleComparator; |
| 14 | -import com.bsth.entity.StationRoute; | 12 | +import com.bsth.data.schedule.late_adjust.LateAdjustHandle; |
| 15 | import com.bsth.entity.directive.D60; | 13 | import com.bsth.entity.directive.D60; |
| 16 | -import com.bsth.entity.realcontrol.LineConfig; | ||
| 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 18 | -import com.bsth.entity.sys.SysUser; | ||
| 19 | import com.bsth.repository.StationRouteRepository; | 15 | import com.bsth.repository.StationRouteRepository; |
| 20 | -import com.bsth.security.util.SecurityUtils; | ||
| 21 | import com.bsth.service.directive.DirectiveService; | 16 | import com.bsth.service.directive.DirectiveService; |
| 22 | import com.bsth.service.realcontrol.ScheduleRealInfoService; | 17 | import com.bsth.service.realcontrol.ScheduleRealInfoService; |
| 23 | import com.bsth.util.HttpClientUtils; | 18 | import com.bsth.util.HttpClientUtils; |
| 24 | import org.apache.commons.lang3.StringUtils; | 19 | import org.apache.commons.lang3.StringUtils; |
| 25 | -import org.joda.time.format.DateTimeFormat; | ||
| 26 | -import org.joda.time.format.DateTimeFormatter; | ||
| 27 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
| 28 | import org.slf4j.LoggerFactory; | 21 | import org.slf4j.LoggerFactory; |
| 29 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| 30 | import org.springframework.stereotype.Component; | 23 | import org.springframework.stereotype.Component; |
| 31 | - | ||
| 32 | -import javax.xml.crypto.Data; | ||
| 33 | import java.text.ParseException; | 24 | import java.text.ParseException; |
| 34 | import java.text.SimpleDateFormat; | 25 | import java.text.SimpleDateFormat; |
| 35 | import java.util.*; | 26 | import java.util.*; |
| @@ -57,13 +48,15 @@ public class AutomaticSch { | @@ -57,13 +48,15 @@ public class AutomaticSch { | ||
| 57 | StationRouteRepository stationRouteRepository; | 48 | StationRouteRepository stationRouteRepository; |
| 58 | @Autowired | 49 | @Autowired |
| 59 | OutEntrance outEntrance; | 50 | OutEntrance outEntrance; |
| 51 | + @Autowired | ||
| 52 | + carMonitor carMonitor; | ||
| 53 | + @Autowired | ||
| 54 | + BasicData basicData; | ||
| 60 | 55 | ||
| 61 | - private static DateTimeFormatter fmtHHmmss = DateTimeFormat.forPattern("HHmmss"); | ||
| 62 | - private static SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 63 | - private static DateTimeFormatter fmtyyyyMMddHHmmss = DateTimeFormat.forPattern("yyyy-MM-ddHHmmss"); | ||
| 64 | private static SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | 56 | private static SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); |
| 65 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); | 57 | SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| 66 | - | 58 | + |
| 59 | + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ2(); | ||
| 67 | private Map<String,Long> drivreMap =new HashMap<>(); //自动重发map | 60 | private Map<String,Long> drivreMap =new HashMap<>(); //自动重发map |
| 68 | // 当日60指令缓存 | 61 | // 当日60指令缓存 |
| 69 | private ConcurrentMap<Integer, D60> d60Map = new ConcurrentHashMap<>();//d60map | 62 | private ConcurrentMap<Integer, D60> d60Map = new ConcurrentHashMap<>();//d60map |
| @@ -132,13 +125,12 @@ public class AutomaticSch { | @@ -132,13 +125,12 @@ public class AutomaticSch { | ||
| 132 | //获取所有线路 | 125 | //获取所有线路 |
| 133 | Map<String, String> lineMap = BasicData.lineCode2NameMap; | 126 | Map<String, String> lineMap = BasicData.lineCode2NameMap; |
| 134 | for (Map.Entry<String, String> t : lineMap.entrySet()){ | 127 | for (Map.Entry<String, String> t : lineMap.entrySet()){ |
| 135 | - List<GpsEntity> gpslist = gpsRealData.getByLine(t.getKey()); | ||
| 136 | List<ScheduleRealInfo> srList = dayOfSchedule.findByLineCode(t.getKey()); | 128 | List<ScheduleRealInfo> srList = dayOfSchedule.findByLineCode(t.getKey()); |
| 137 | for (ScheduleRealInfo sr : srList){ | 129 | for (ScheduleRealInfo sr : srList){ |
| 138 | //1.离线 2.实发时间为空 3.已过待发时间还没发车的 | 130 | //1.离线 2.实发时间为空 3.已过待发时间还没发车的 |
| 139 | long time = System.currentTimeMillis();//实际时间+2分钟 | 131 | long time = System.currentTimeMillis();//实际时间+2分钟 |
| 140 | //超过待发时间 实发时间还是null的 | 132 | //超过待发时间 实发时间还是null的 |
| 141 | - if (sr.getFcsjT() + (1000*3) < time) { | 133 | + if (sr.getFcsjT() + (1000*3) > time) { |
| 142 | 134 | ||
| 143 | //起点站实际到达时间为null的情况下 | 135 | //起点站实际到达时间为null的情况下 |
| 144 | if (StringUtils.isEmpty(sr.getQdzArrDatesj())) { | 136 | if (StringUtils.isEmpty(sr.getQdzArrDatesj())) { |
| @@ -150,7 +142,7 @@ public class AutomaticSch { | @@ -150,7 +142,7 @@ public class AutomaticSch { | ||
| 150 | } | 142 | } |
| 151 | //第一种 设备离线的情况下改出站 | 143 | //第一种 设备离线的情况下改出站 |
| 152 | Integer staus = 0; //状态 | 144 | Integer staus = 0; //状态 |
| 153 | - if (StringUtils.isEmpty(sr.getFcsjActual()) && sr.getBcType().equals("normal") && sr.getRemarks() == null) { | 145 | + if (StringUtils.isEmpty(sr.getFcsjActual()) && sr.getBcType().equals("normal") && StringUtils.isEmpty(sr.getRemarks())) { |
| 154 | 146 | ||
| 155 | GpsEntity gps = gpsRealData.getByNbbm(sr.getClZbh()); | 147 | GpsEntity gps = gpsRealData.getByNbbm(sr.getClZbh()); |
| 156 | //当前设备离线的情况 | 148 | //当前设备离线的情况 |
| @@ -189,7 +181,7 @@ public class AutomaticSch { | @@ -189,7 +181,7 @@ public class AutomaticSch { | ||
| 189 | Collections.sort(oldSchDateList, new ScheduleComparator.FCSJ()); | 181 | Collections.sort(oldSchDateList, new ScheduleComparator.FCSJ()); |
| 190 | for (ScheduleRealInfo t : oldSchDateList){ | 182 | for (ScheduleRealInfo t : oldSchDateList){ |
| 191 | // 发车误点 | 183 | // 发车误点 |
| 192 | - if (t.getFcsj() != null && t.getFcsjActual() != null && t.getBcType().equals("normal") && t.getRemarks() == null){ | 184 | + if (t.getFcsj() != null && t.getFcsjActual() != null && t.getBcType().equals("normal") && StringUtils.isEmpty(t.getRemarks())){ |
| 193 | Long sst = ((t.getFcsjActualTime() - t.getFcsjT()) / 1000 / 60); | 185 | Long sst = ((t.getFcsjActualTime() - t.getFcsjT()) / 1000 / 60); |
| 194 | Long fcsj = t.getFcsjT() / 1000 ; | 186 | Long fcsj = t.getFcsjT() / 1000 ; |
| 195 | Long sfsj = t.getFcsjActualTime() / 1000; | 187 | Long sfsj = t.getFcsjActualTime() / 1000; |
| @@ -284,23 +276,50 @@ public class AutomaticSch { | @@ -284,23 +276,50 @@ public class AutomaticSch { | ||
| 284 | } | 276 | } |
| 285 | } | 277 | } |
| 286 | } | 278 | } |
| 287 | - | ||
| 288 | - | ||
| 289 | - | ||
| 290 | - | ||
| 291 | }catch (Exception e){ | 279 | }catch (Exception e){ |
| 292 | logger.error("自动调度,指令重发---",e); | 280 | logger.error("自动调度,指令重发---",e); |
| 293 | } | 281 | } |
| 294 | logger.warn("指令重发扫描结束"); | 282 | logger.warn("指令重发扫描结束"); |
| 295 | } | 283 | } |
| 296 | - | ||
| 297 | //误点检测 调度有的-LateAdjustHandle | 284 | //误点检测 调度有的-LateAdjustHandle |
| 298 | - public Map wd(ScheduleRealInfo sch){ | 285 | + public Map wd(){ |
| 299 | //推送 | 286 | //推送 |
| 300 | try{ | 287 | try{ |
| 301 | - return addStationPeople(sch, "WD", 0L); | 288 | + List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll()); |
| 289 | + Collections.sort(all, cpm); | ||
| 290 | + long t = System.currentTimeMillis(); | ||
| 291 | + int size = all.size(); | ||
| 292 | + ScheduleRealInfo sch; | ||
| 293 | + for(int i = 0; i < size; i ++){ | ||
| 294 | + sch = all.get(i); | ||
| 295 | + if(sch.getDfsjT() > t) | ||
| 296 | + break; | ||
| 297 | + | ||
| 298 | + /*if(sch.isLate()) | ||
| 299 | + continue;*/ | ||
| 300 | + | ||
| 301 | + if(sch.getStatus() == 0 | ||
| 302 | + && StringUtils.isEmpty(sch.getFcsjActual())){ | ||
| 303 | + | ||
| 304 | + //检查应发未到 当前班次无起点到达时间 | ||
| 305 | + if(StringUtils.isEmpty(sch.getQdzArrDatesj())){ | ||
| 306 | + ScheduleRealInfo prev = dayOfSchedule.prev(sch); | ||
| 307 | + //上一个班次也没有实际终点到达时间 | ||
| 308 | + if(prev != null && StringUtils.isEmpty(prev.getZdsjActual())){ | ||
| 309 | + //进入误点调整程序 | ||
| 310 | + LateAdjustHandle.putLate(sch); | ||
| 311 | + List<Map> dzList = carMonitor.carMonitor(prev.getXlBm(), prev.getXlDir(), prev.getZdzCode()); //信息发布接口 | ||
| 312 | + for (Map m : dzList){ | ||
| 313 | + if (m.get("terminal").equals(basicData.nbbmCompanyPlateMap.get(prev.getClZbh()).replaceAll("-",""))){ | ||
| 314 | + return addStationPeople(sch, "WD", 0L); | ||
| 315 | + } | ||
| 316 | + } | ||
| 317 | + } | ||
| 318 | + }; | ||
| 319 | + } | ||
| 320 | + } | ||
| 302 | }catch (Exception e){ | 321 | }catch (Exception e){ |
| 303 | - logger.error("自动调度,推送失败---",e); | 322 | + logger.error("误点检测推送接口出错---",e); |
| 304 | } | 323 | } |
| 305 | return null; | 324 | return null; |
| 306 | } | 325 | } |
| @@ -324,12 +343,6 @@ public class AutomaticSch { | @@ -324,12 +343,6 @@ public class AutomaticSch { | ||
| 324 | } | 343 | } |
| 325 | } | 344 | } |
| 326 | outEntrance.Znddjk(m);//测试推送 | 345 | outEntrance.Znddjk(m);//测试推送 |
| 327 | - if (i == list.size()){ | ||
| 328 | - list.add(sj); | ||
| 329 | - ZnddThread.ZNDDTYPEMAP.put(st,list);//存记录 | ||
| 330 | - outEntrance.Znddjk(m);//推送 | ||
| 331 | - } | ||
| 332 | - return; | ||
| 333 | }else { | 346 | }else { |
| 334 | list.add(sj); | 347 | list.add(sj); |
| 335 | ZnddThread.ZNDDTYPEMAP.put(st,list);//存记录 | 348 | ZnddThread.ZNDDTYPEMAP.put(st,list);//存记录 |
src/main/java/com/bsth/data/zndd/OutEntrance.java
| 1 | package com.bsth.data.zndd; | 1 | package com.bsth.data.zndd; |
| 2 | import com.bsth.common.ResponseCode; | 2 | import com.bsth.common.ResponseCode; |
| 3 | import com.bsth.data.schedule.DayOfSchedule; | 3 | import com.bsth.data.schedule.DayOfSchedule; |
| 4 | -import com.bsth.data.schedule.ScheduleComparator; | ||
| 5 | -import com.bsth.data.adjg.domain.LargeGap; | ||
| 6 | import com.bsth.websocket.handler.SendUtils; | 4 | import com.bsth.websocket.handler.SendUtils; |
| 7 | import com.fasterxml.jackson.databind.ObjectMapper; | 5 | import com.fasterxml.jackson.databind.ObjectMapper; |
| 8 | import org.slf4j.Logger; | 6 | import org.slf4j.Logger; |
| 9 | import org.slf4j.LoggerFactory; | 7 | import org.slf4j.LoggerFactory; |
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | -import org.springframework.beans.factory.annotation.Value; | ||
| 12 | import org.springframework.web.bind.annotation.*; | 9 | import org.springframework.web.bind.annotation.*; |
| 13 | -import sun.misc.BASE64Decoder; | ||
| 14 | - | ||
| 15 | import java.io.*; | 10 | import java.io.*; |
| 16 | import java.text.SimpleDateFormat; | 11 | import java.text.SimpleDateFormat; |
| 17 | -import java.time.LocalTime; | ||
| 18 | -import java.time.format.DateTimeFormatter; | ||
| 19 | import java.util.*; | 12 | import java.util.*; |
| 20 | 13 | ||
| 21 | /** | 14 | /** |
| @@ -170,10 +163,10 @@ public class OutEntrance { | @@ -170,10 +163,10 @@ public class OutEntrance { | ||
| 170 | 163 | ||
| 171 | 164 | ||
| 172 | base=base.replaceAll("data:image/png;base64,",""); | 165 | base=base.replaceAll("data:image/png;base64,",""); |
| 173 | - BASE64Decoder decoder = new BASE64Decoder(); | 166 | + Base64.Decoder decoder = Base64.getDecoder(); |
| 174 | byte[] imageByte = null; | 167 | byte[] imageByte = null; |
| 175 | try{ | 168 | try{ |
| 176 | - imageByte = decoder.decodeBuffer(base); | 169 | + imageByte = decoder.decode(base); |
| 177 | for (int i = 0; i < imageByte.length; ++i) { | 170 | for (int i = 0; i < imageByte.length; ++i) { |
| 178 | if (imageByte[i] < 0) {// 调整异常数据 | 171 | if (imageByte[i] < 0) {// 调整异常数据 |
| 179 | imageByte[i] += 256; | 172 | imageByte[i] += 256; |
src/main/java/com/bsth/data/zndd/ZnddThread.java
| @@ -80,6 +80,10 @@ public class ZnddThread extends Thread{ | @@ -80,6 +80,10 @@ public class ZnddThread extends Thread{ | ||
| 80 | automaticSch.drivresponse(); | 80 | automaticSch.drivresponse(); |
| 81 | logger.info("设备重发执行完毕"); | 81 | logger.info("设备重发执行完毕"); |
| 82 | } | 82 | } |
| 83 | + if (zs.getType().equals("wd")){ | ||
| 84 | + automaticSch.wd(); | ||
| 85 | + logger.info("误点执行完毕"); | ||
| 86 | + } | ||
| 83 | } | 87 | } |
| 84 | } | 88 | } |
| 85 | }catch (Exception e){ | 89 | }catch (Exception e){ |
src/main/java/com/bsth/data/zndd/carMonitor.java
0 → 100644
| 1 | +package com.bsth.data.zndd; | ||
| 2 | + | ||
| 3 | +import org.apache.commons.io.IOUtils; | ||
| 4 | +import org.dom4j.Document; | ||
| 5 | +import org.dom4j.DocumentHelper; | ||
| 6 | +import org.dom4j.Element; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +import java.io.ByteArrayOutputStream; | ||
| 12 | +import java.io.InputStream; | ||
| 13 | +import java.io.OutputStream; | ||
| 14 | +import java.net.HttpURLConnection; | ||
| 15 | +import java.net.URL; | ||
| 16 | +import java.nio.charset.Charset; | ||
| 17 | +import java.util.*; | ||
| 18 | + | ||
| 19 | +@Component | ||
| 20 | +public class carMonitor { | ||
| 21 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 22 | + | ||
| 23 | + static String url; | ||
| 24 | + | ||
| 25 | + | ||
| 26 | + public List<Map> carMonitor(String lineCode,String directions,String station) { | ||
| 27 | + | ||
| 28 | + List<Map> list = new ArrayList<>(); //返回的接口数据 | ||
| 29 | + url = "http://58.34.52.130:9777/xxfb/carMonitor?lineid="+lineCode+"&stopid="+station+"&direction="+directions+"&t="; | ||
| 30 | + InputStream in = null; | ||
| 31 | + OutputStream out = null; | ||
| 32 | + try { | ||
| 33 | + HttpURLConnection con = (HttpURLConnection)new URL(url).openConnection(); | ||
| 34 | + con.setDoInput(true); | ||
| 35 | + con.setDoOutput(true); | ||
| 36 | + con.setRequestMethod("GET"); | ||
| 37 | + con.setConnectTimeout(15000); | ||
| 38 | + con.setReadTimeout(15000); | ||
| 39 | + con.setRequestProperty("keep-alive", "true"); | ||
| 40 | + con.setRequestProperty("accept", "application/json"); | ||
| 41 | + con.setRequestProperty("content-type", "application/json;charset=UTF-8"); | ||
| 42 | + | ||
| 43 | + //System.out.println(con.getResponseCode()); | ||
| 44 | + //if (con.getResponseCode() == 200) { | ||
| 45 | + in = con.getInputStream(); | ||
| 46 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | ||
| 47 | + IOUtils.copy(in, bout); | ||
| 48 | + //System.out.println(new String(bout.toByteArray())); | ||
| 49 | + if (bout.toByteArray().length == 0){ | ||
| 50 | + return list; | ||
| 51 | + } | ||
| 52 | + Document doc = null; | ||
| 53 | + doc = DocumentHelper.parseText(new String(bout.toByteArray(), Charset.forName("UTF-8"))); | ||
| 54 | + | ||
| 55 | + // 获取根节点 | ||
| 56 | + Element rootElt = doc.getRootElement(); | ||
| 57 | + //获取到根节点的名称 | ||
| 58 | + //System.out.println("根节点:" + rootElt.getName()); | ||
| 59 | + | ||
| 60 | + Iterator iter = rootElt.elementIterator("cars"); | ||
| 61 | + while (iter.hasNext()) { | ||
| 62 | + //获取到第二级节点元所有元素 | ||
| 63 | + Element sessionEle = (Element) iter.next(); | ||
| 64 | + //System.out.println("-第一级节点名称: " + sessionEle.getName()); | ||
| 65 | + //获取到第二级节点指定的子节点 | ||
| 66 | + Iterator iterResponse = sessionEle.elementIterator("car"); | ||
| 67 | + while (iterResponse.hasNext()){ | ||
| 68 | + Map map = new HashMap(); | ||
| 69 | + //获取到所有第三级子节点所有元素 | ||
| 70 | + Element responseEle = (Element) iterResponse.next(); | ||
| 71 | + //System.out.println("--第二级节点名称: "+ responseEle.getName()); | ||
| 72 | + //获取到第三级节点指定的子节点 | ||
| 73 | + map.put("terminal",responseEle.elementTextTrim("terminal")); | ||
| 74 | + map.put("stopdis",responseEle.elementTextTrim("stopdis")); | ||
| 75 | + map.put("distance",responseEle.elementTextTrim("distance")); | ||
| 76 | + map.put("time",responseEle.elementTextTrim("time")); | ||
| 77 | + map.put("sj",Gpstime(responseEle.elementTextTrim("time"))); | ||
| 78 | + map.put("loc",responseEle.elementTextTrim("loc")); | ||
| 79 | + map.put("gpstime",responseEle.elementTextTrim("gpstime")); | ||
| 80 | + map.put("direction",responseEle.elementTextTrim("direction")); | ||
| 81 | + list.add(map); | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + //System.out.println(maps.size()); | ||
| 85 | + } catch (Exception e) { | ||
| 86 | + logger.error("信息发布接口报错了----", e); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + return list; | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + public String Gpstime(String duration){ | ||
| 93 | + Integer seconds = Integer.parseInt(duration); | ||
| 94 | + Integer hours = seconds / 3600; | ||
| 95 | + Integer minutes = (seconds % 3600) / 60; | ||
| 96 | + Integer remainingSeconds = seconds % 60; | ||
| 97 | + | ||
| 98 | + if (hours!= 0){ | ||
| 99 | + return hours+"时"+ minutes+"分"+remainingSeconds+"秒"; | ||
| 100 | + }else if (minutes != 0){ | ||
| 101 | + return minutes+"分"+remainingSeconds+"秒"; | ||
| 102 | + }else { | ||
| 103 | + return remainingSeconds+"秒"; | ||
| 104 | + } | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | +} |
src/main/java/com/bsth/security/SsoConfig.java
| 1 | package com.bsth.security; | 1 | package com.bsth.security; |
| 2 | 2 | ||
| 3 | import com.bsth.common.Constants; | 3 | import com.bsth.common.Constants; |
| 4 | +import com.bsth.data.SystemParamCache; | ||
| 5 | +import org.springframework.beans.factory.InitializingBean; | ||
| 4 | import org.springframework.beans.factory.annotation.Value; | 6 | import org.springframework.beans.factory.annotation.Value; |
| 5 | import org.springframework.stereotype.Component; | 7 | import org.springframework.stereotype.Component; |
| 6 | 8 | ||
| @@ -9,7 +11,7 @@ import org.springframework.stereotype.Component; | @@ -9,7 +11,7 @@ import org.springframework.stereotype.Component; | ||
| 9 | * @author Hill | 11 | * @author Hill |
| 10 | */ | 12 | */ |
| 11 | @Component | 13 | @Component |
| 12 | -public class SsoConfig { | 14 | +public class SsoConfig implements InitializingBean { |
| 13 | 15 | ||
| 14 | /** | 16 | /** |
| 15 | * 是否开启sso登录 | 17 | * 是否开启sso登录 |
| @@ -87,4 +89,10 @@ public class SsoConfig { | @@ -87,4 +89,10 @@ public class SsoConfig { | ||
| 87 | public void setSsoAuthUrl(String ssoAuthUrl) { | 89 | public void setSsoAuthUrl(String ssoAuthUrl) { |
| 88 | this.ssoAuthUrl = ssoAuthUrl; | 90 | this.ssoAuthUrl = ssoAuthUrl; |
| 89 | } | 91 | } |
| 92 | + | ||
| 93 | + @Override | ||
| 94 | + public void afterPropertiesSet() throws Exception { | ||
| 95 | + setSystemCode(SystemParamCache.getSsoSystemCode()); | ||
| 96 | + setSsoAuthUrl(SystemParamCache.getUrlHttpSsoAuth()); | ||
| 97 | + } | ||
| 90 | } | 98 | } |