Commit f7523f0aa91d3452cea052dd94a9ece5d9f6d7f7
1 parent
061f1a92
dify接口优化、响应式公交自动对接
Showing
26 changed files
with
1212 additions
and
51 deletions
src/main/java/com/bsth/XDApplication.java
| @@ -24,6 +24,7 @@ import com.bsth.data.schedule.thread.ScheduleRefreshThread; | @@ -24,6 +24,7 @@ import com.bsth.data.schedule.thread.ScheduleRefreshThread; | ||
| 24 | import com.bsth.data.schedule.thread.SubmitToTrafficManage; | 24 | import com.bsth.data.schedule.thread.SubmitToTrafficManage; |
| 25 | import com.bsth.data.zndd.ZnddThread; | 25 | import com.bsth.data.zndd.ZnddThread; |
| 26 | import com.bsth.data.zndd.ZnddTwoThread; | 26 | import com.bsth.data.zndd.ZnddTwoThread; |
| 27 | +import com.bsth.data.zndd.outer_car.OrderListThread; | ||
| 27 | import com.bsth.util.DateUtils; | 28 | import com.bsth.util.DateUtils; |
| 28 | import com.bsth.util.Tools; | 29 | import com.bsth.util.Tools; |
| 29 | import org.slf4j.Logger; | 30 | import org.slf4j.Logger; |
| @@ -95,6 +96,9 @@ public class XDApplication implements CommandLineRunner { | @@ -95,6 +96,9 @@ public class XDApplication implements CommandLineRunner { | ||
| 95 | @Autowired | 96 | @Autowired |
| 96 | FixedCheckStationCodeThread fixedCheckStationCodeThread; | 97 | FixedCheckStationCodeThread fixedCheckStationCodeThread; |
| 97 | 98 | ||
| 99 | + @Autowired | ||
| 100 | + OrderListThread orderListThread; | ||
| 101 | + | ||
| 98 | private static long timeDiff; | 102 | private static long timeDiff; |
| 99 | private static long timeDiffTraffic; | 103 | private static long timeDiffTraffic; |
| 100 | 104 | ||
| @@ -203,6 +207,8 @@ public class XDApplication implements CommandLineRunner { | @@ -203,6 +207,8 @@ public class XDApplication implements CommandLineRunner { | ||
| 203 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); | 207 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); |
| 204 | //智能调度 | 208 | //智能调度 |
| 205 | sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); | 209 | sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); |
| 210 | + //响应式公交自动对接订单 | ||
| 211 | + sexec.scheduleWithFixedDelay(orderListThread, 60, 60 * 30, TimeUnit.SECONDS); | ||
| 206 | GpsDataLoaderThread.setFlag(-1); | 212 | GpsDataLoaderThread.setFlag(-1); |
| 207 | /** 线调业务 */ | 213 | /** 线调业务 */ |
| 208 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 | 214 | sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程 |
| @@ -251,6 +257,9 @@ public class XDApplication implements CommandLineRunner { | @@ -251,6 +257,9 @@ public class XDApplication implements CommandLineRunner { | ||
| 251 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); | 257 | sexec.scheduleWithFixedDelay(znddThread, 30, 30, TimeUnit.SECONDS); |
| 252 | //智能调度 | 258 | //智能调度 |
| 253 | sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); | 259 | sexec.scheduleWithFixedDelay(ZnddtwoThread, 30, 60, TimeUnit.SECONDS); |
| 260 | + //响应式公交自动对接订单 | ||
| 261 | + sexec.scheduleWithFixedDelay(orderListThread, 60, 60 * 30, TimeUnit.SECONDS); | ||
| 262 | + | ||
| 254 | GpsDataLoaderThread.setFlag(-1); | 263 | GpsDataLoaderThread.setFlag(-1); |
| 255 | //dayOfSchedule.dataRecovery(); | 264 | //dayOfSchedule.dataRecovery(); |
| 256 | /** 线调业务 */ | 265 | /** 线调业务 */ |
src/main/java/com/bsth/common/Constants.java
| @@ -46,6 +46,7 @@ public class Constants { | @@ -46,6 +46,7 @@ public class Constants { | ||
| 46 | public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; | 46 | public static final String STATION_AND_SECTION_COUNT = "/station/updateStationAndSectionCode"; |
| 47 | 47 | ||
| 48 | public static final String OUT_URL = "/out/**"; | 48 | public static final String OUT_URL = "/out/**"; |
| 49 | + public static final String DIFYINTER_URL = "/difyinter/**"; | ||
| 49 | public static final String NOTICE_URL = "/notice/**"; | 50 | public static final String NOTICE_URL = "/notice/**"; |
| 50 | /** | 51 | /** |
| 51 | * 解除调度指令和班次的外键约束 | 52 | * 解除调度指令和班次的外键约束 |
src/main/java/com/bsth/data/zndd/AutomaticSch.java
| @@ -242,7 +242,7 @@ public class AutomaticSch { | @@ -242,7 +242,7 @@ public class AutomaticSch { | ||
| 242 | } | 242 | } |
| 243 | 243 | ||
| 244 | } | 244 | } |
| 245 | - }catch (Throwable e){ | 245 | + }catch (Exception e){ |
| 246 | logger.error("自动调度,实发未发推送失败---",e); | 246 | logger.error("自动调度,实发未发推送失败---",e); |
| 247 | } | 247 | } |
| 248 | logger.warn("实发未发扫描结束"); | 248 | logger.warn("实发未发扫描结束"); |
| @@ -303,7 +303,7 @@ public class AutomaticSch { | @@ -303,7 +303,7 @@ public class AutomaticSch { | ||
| 303 | 303 | ||
| 304 | } | 304 | } |
| 305 | } | 305 | } |
| 306 | - }catch (Throwable e){ | 306 | + }catch (Exception e){ |
| 307 | logger.error("实发撤销推送接口出错-----------",e); | 307 | logger.error("实发撤销推送接口出错-----------",e); |
| 308 | } | 308 | } |
| 309 | logger.warn("实发撤销检测扫描结束"); | 309 | logger.warn("实发撤销检测扫描结束"); |
src/main/java/com/bsth/data/zndd/DifyEntrance.java
0 → 100644
| 1 | +package com.bsth.data.zndd; | ||
| 2 | + | ||
| 3 | + | ||
| 4 | +import com.bsth.data.BasicData; | ||
| 5 | +import com.bsth.service.zndd.LoggerZnddService; | ||
| 6 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RequestMethod; | ||
| 9 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 10 | +import org.springframework.web.bind.annotation.RestController; | ||
| 11 | + | ||
| 12 | +import java.util.Collection; | ||
| 13 | +import java.util.List; | ||
| 14 | +import java.util.Map; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * dify的各种接口 | ||
| 18 | + */ | ||
| 19 | + | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("/difyinter") | ||
| 22 | +public class DifyEntrance { | ||
| 23 | + | ||
| 24 | + @Autowired | ||
| 25 | + LoggerZnddService loggerZnddService; | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * schDeepSeep查询班次情况 | ||
| 29 | + * @param | ||
| 30 | + * @return | ||
| 31 | + */ | ||
| 32 | + @RequestMapping(value = "schDeepSeep", method = RequestMethod.GET) | ||
| 33 | + public Map schDeepSeep(@RequestParam String message){ | ||
| 34 | + return loggerZnddService.schDeepSeep(message); | ||
| 35 | + } | ||
| 36 | + @RequestMapping(value = "lineyd", method = RequestMethod.GET) | ||
| 37 | + //线路是否拥堵 | ||
| 38 | + public String line_yd(String message){ | ||
| 39 | + return loggerZnddService.line_yd(message); | ||
| 40 | + } | ||
| 41 | + //线路数量 | ||
| 42 | + @RequestMapping(value = "lineNum", method = RequestMethod.GET) | ||
| 43 | + public Collection<String> LineNum(){ | ||
| 44 | + return BasicData.lineCode2NameMap.values(); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + //班次执行详情 | ||
| 48 | + @RequestMapping(value = "linezd", method = RequestMethod.GET) | ||
| 49 | + public List line_zd(String message){ | ||
| 50 | + return loggerZnddService.line_zd(message); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + | ||
| 54 | + | ||
| 55 | +} |
src/main/java/com/bsth/data/zndd/OutEntrance.java
| @@ -13,7 +13,6 @@ import com.bsth.entity.zndd.StationSignsLogger; | @@ -13,7 +13,6 @@ import com.bsth.entity.zndd.StationSignsLogger; | ||
| 13 | import com.bsth.entity.zndd.znddStatus; | 13 | import com.bsth.entity.zndd.znddStatus; |
| 14 | import com.bsth.repository.zndd.ZnddStatusRepository; | 14 | import com.bsth.repository.zndd.ZnddStatusRepository; |
| 15 | import com.bsth.service.DKLInfoService; | 15 | import com.bsth.service.DKLInfoService; |
| 16 | -import com.bsth.service.zndd.LoggerZnddService; | ||
| 17 | import com.bsth.util.HttpClientUtils; | 16 | import com.bsth.util.HttpClientUtils; |
| 18 | import com.bsth.util.SignUtils; | 17 | import com.bsth.util.SignUtils; |
| 19 | import com.bsth.websocket.handler.SendUtils; | 18 | import com.bsth.websocket.handler.SendUtils; |
| @@ -84,8 +83,7 @@ public class OutEntrance { | @@ -84,8 +83,7 @@ public class OutEntrance { | ||
| 84 | @Autowired | 83 | @Autowired |
| 85 | ZnddMessage znddMessage; | 84 | ZnddMessage znddMessage; |
| 86 | 85 | ||
| 87 | - @Autowired | ||
| 88 | - LoggerZnddService loggerZnddService; | 86 | + |
| 89 | 87 | ||
| 90 | //调度屏小程序接口。 | 88 | //调度屏小程序接口。 |
| 91 | @RequestMapping(value = "/OutCar", method = RequestMethod.POST) | 89 | @RequestMapping(value = "/OutCar", method = RequestMethod.POST) |
| @@ -513,16 +511,5 @@ public class OutEntrance { | @@ -513,16 +511,5 @@ public class OutEntrance { | ||
| 513 | 511 | ||
| 514 | 512 | ||
| 515 | 513 | ||
| 516 | - /** | ||
| 517 | - * schDeepSeep查询班次情况 | ||
| 518 | - * @param | ||
| 519 | - * @return | ||
| 520 | - */ | ||
| 521 | - @RequestMapping(value = "schDeepSeep", method = RequestMethod.GET) | ||
| 522 | - public Map schDeepSeep(@RequestParam String message){ | ||
| 523 | - return loggerZnddService.schDeepSeep(message); | ||
| 524 | - } | ||
| 525 | - | ||
| 526 | - | ||
| 527 | 514 | ||
| 528 | } | 515 | } |
src/main/java/com/bsth/data/zndd/dify/BusCongestionChecker.java
0 → 100644
| 1 | +package com.bsth.data.zndd.dify; | ||
| 2 | + | ||
| 3 | +import com.fasterxml.jackson.databind.JsonNode; | ||
| 4 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 5 | +import org.apache.http.HttpEntity; | ||
| 6 | +import org.apache.http.client.methods.CloseableHttpResponse; | ||
| 7 | +import org.apache.http.client.methods.HttpGet; | ||
| 8 | +import org.apache.http.impl.client.CloseableHttpClient; | ||
| 9 | +import org.apache.http.impl.client.HttpClients; | ||
| 10 | +import org.apache.http.util.EntityUtils; | ||
| 11 | +import org.slf4j.Logger; | ||
| 12 | +import org.slf4j.LoggerFactory; | ||
| 13 | +import org.springframework.beans.factory.annotation.Value; | ||
| 14 | + | ||
| 15 | +import java.util.ArrayList; | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +public class BusCongestionChecker { | ||
| 19 | + private static final String AK = "baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK"; // 替换为百度AK | ||
| 20 | + private static final String ORIGIN = "40.056878,116.30815"; // 起点坐标 | ||
| 21 | + private static final String DESTINATION = "39.915285,116.403857"; // 终点坐标 | ||
| 22 | + private static final String CITY = "上海"; // 城市名 | ||
| 23 | + | ||
| 24 | + static Logger logger = LoggerFactory.getLogger(BusCongestionChecker.class); | ||
| 25 | + | ||
| 26 | + @Value("${baidu.ak}") | ||
| 27 | + private static String ak; //百度api秘钥*/ | ||
| 28 | + //道路拥堵情况 // 起点坐标 // 终点坐标 | ||
| 29 | + public static String DL_YDQK(String origin, String destination,String city,String line){ | ||
| 30 | + String resultString = ""; | ||
| 31 | + try { | ||
| 32 | + String apiUrl = String.format( | ||
| 33 | + "http://api.map.baidu.com/direction/v2/transit?" + | ||
| 34 | + "origin=%s&destination=%s&ak=%s&city=%s", | ||
| 35 | + origin, destination, ak, city | ||
| 36 | + ); | ||
| 37 | + | ||
| 38 | + // 发送HTTP请求 | ||
| 39 | + CloseableHttpClient httpClient = HttpClients.createDefault(); | ||
| 40 | + HttpGet request = new HttpGet(apiUrl); | ||
| 41 | + CloseableHttpResponse response = httpClient.execute(request); | ||
| 42 | + | ||
| 43 | + // 解析JSON响应 | ||
| 44 | + HttpEntity entity = response.getEntity(); | ||
| 45 | + String jsonResponse = EntityUtils.toString(entity); | ||
| 46 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 47 | + JsonNode root = mapper.readTree(jsonResponse); | ||
| 48 | + | ||
| 49 | + // 检查API调用状态 | ||
| 50 | + if (root.path("status").asInt() != 0) { | ||
| 51 | + logger.info("API请求失败: " + root.path("message").asText()); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + // 遍历所有公交路线 | ||
| 55 | + JsonNode routes = root.path("result").path("routes"); | ||
| 56 | + for (JsonNode route : routes) { | ||
| 57 | + // 检查是否为目标线路 | ||
| 58 | + JsonNode steps = route.path("steps"); | ||
| 59 | + boolean isTargetLine = false; | ||
| 60 | + List<String> congestionSections = new ArrayList<>(); | ||
| 61 | + | ||
| 62 | + for (JsonNode step : steps) { | ||
| 63 | + // 匹配公交线路名称 | ||
| 64 | + JsonNode vehicle = step.path("vehicle"); | ||
| 65 | + if (vehicle.path("name").asText().equals(line)) { | ||
| 66 | + isTargetLine = true; | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + // 解析交通状况(具体拥堵路段) | ||
| 70 | + JsonNode trafficConditions = step.path("traffic_condition"); | ||
| 71 | + for (JsonNode condition : trafficConditions) { | ||
| 72 | + int status = condition.path("status").asInt(); | ||
| 73 | + String sectionDesc = condition.path("desc").asText(); // 拥堵路段描述 | ||
| 74 | + if (status == 3) { // 3表示拥堵 | ||
| 75 | + congestionSections.add(sectionDesc); | ||
| 76 | + } | ||
| 77 | + } | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + // 输出结果 | ||
| 81 | + if (isTargetLine && !congestionSections.isEmpty()) { | ||
| 82 | + resultString += ("公交线路 " + line + " 存在拥堵路段:"); | ||
| 83 | + for (String section : congestionSections){ | ||
| 84 | + resultString +=(" - 拥堵路段: " + section); | ||
| 85 | + } | ||
| 86 | + } | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + resultString +=("公交线路 " + line + " 当前畅通。"); | ||
| 90 | + | ||
| 91 | + } catch (Exception e) { | ||
| 92 | + e.printStackTrace(); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + return resultString; | ||
| 96 | + } | ||
| 97 | +} | ||
| 0 | \ No newline at end of file | 98 | \ No newline at end of file |
src/main/java/com/bsth/data/zndd/outer_car/Ordehttp.java
0 → 100644
| 1 | +package com.bsth.data.zndd.outer_car; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSON; | ||
| 4 | +import com.alibaba.fastjson.JSONObject; | ||
| 5 | +import com.bsth.util.HttpClientUtils; | ||
| 6 | +import com.fasterxml.jackson.databind.ObjectMapper; | ||
| 7 | +import org.slf4j.Logger; | ||
| 8 | +import org.slf4j.LoggerFactory; | ||
| 9 | +import org.springframework.stereotype.Component; | ||
| 10 | + | ||
| 11 | +import java.text.SimpleDateFormat; | ||
| 12 | +import java.util.*; | ||
| 13 | + | ||
| 14 | + | ||
| 15 | +@Component | ||
| 16 | +public class Ordehttp { | ||
| 17 | + | ||
| 18 | + Logger logger = LoggerFactory.getLogger(this.getClass()); | ||
| 19 | + | ||
| 20 | + private static SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 21 | + | ||
| 22 | + //订单登录 | ||
| 23 | + public String Orderlogin(){ | ||
| 24 | + | ||
| 25 | + String toKen = null; | ||
| 26 | + Map<String,String> pam = new HashMap<>(); | ||
| 27 | + | ||
| 28 | + HashMap<String, Object> data = new HashMap<>(); | ||
| 29 | + data.put("UserName", "ykzx"); | ||
| 30 | + data.put("Password", "1865c4c07cf8c3b09b121894adb14ebe"); | ||
| 31 | + | ||
| 32 | + | ||
| 33 | + | ||
| 34 | + String urll = "https://lgdzgj.71ad.com/User/Login"; | ||
| 35 | + try { | ||
| 36 | + | ||
| 37 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 38 | + String jsonBody = mapper.writeValueAsString(data); | ||
| 39 | + | ||
| 40 | + StringBuilder sb = HttpClientUtils.post(urll, jsonBody); | ||
| 41 | + JSONObject obj = JSON.parseObject(sb.toString()); | ||
| 42 | + toKen = obj.getString("data"); | ||
| 43 | + }catch (Exception e){ | ||
| 44 | + logger.error("获取token登录失败-",e); | ||
| 45 | + } | ||
| 46 | + return toKen; | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + //获取历史订单 | ||
| 50 | + public List<Map> OrderList(String token){ | ||
| 51 | + | ||
| 52 | + List<Map> mapList = new ArrayList<>(); | ||
| 53 | + Map<String,String> pam = new HashMap<>(); | ||
| 54 | + | ||
| 55 | + HashMap<String, Object> data = new HashMap<>(); | ||
| 56 | + data.put("OrderDate", sdfMonth.format(new Date())); | ||
| 57 | + | ||
| 58 | + String urll = "https://lgdzgj.71ad.com/ServiceData/Outer/GetOuterOrderHisList"; | ||
| 59 | + try { | ||
| 60 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 61 | + String jsonBody = mapper.writeValueAsString(data); | ||
| 62 | + Map<String, Object> headers = new HashMap<>(); | ||
| 63 | + headers.put("token",token); | ||
| 64 | + StringBuilder sb = HttpClientUtils.post(urll, jsonBody,headers); | ||
| 65 | + JSONObject obj = JSON.parseObject(sb.toString()); | ||
| 66 | + mapList= JSON.parseArray(obj.getString("data"), Map.class); | ||
| 67 | + }catch (Exception e){ | ||
| 68 | + logger.error("历史订单获取失败-",e); | ||
| 69 | + } | ||
| 70 | + return mapList; | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | +} |
src/main/java/com/bsth/data/zndd/outer_car/OrderListThread.java
0 → 100644
| 1 | +package com.bsth.data.zndd.outer_car; | ||
| 2 | + | ||
| 3 | +import com.bsth.data.BasicData; | ||
| 4 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 5 | +import com.bsth.data.gpsdata_v2.entity.StationRoute; | ||
| 6 | +import com.bsth.data.schedule.DayOfSchedule; | ||
| 7 | +import com.bsth.data.schedule.ScheduleComparator; | ||
| 8 | +import com.bsth.entity.Line; | ||
| 9 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | ||
| 10 | +import com.bsth.repository.realcontrol.ScheduleRealInfoRepository; | ||
| 11 | +import com.bsth.service.LineService; | ||
| 12 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 13 | +import com.bsth.util.db.DBUtils_MS; | ||
| 14 | +import com.bsth.websocket.handler.SendUtils; | ||
| 15 | +import org.joda.time.format.DateTimeFormat; | ||
| 16 | +import org.joda.time.format.DateTimeFormatter; | ||
| 17 | +import org.slf4j.Logger; | ||
| 18 | +import org.slf4j.LoggerFactory; | ||
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 20 | +import org.springframework.stereotype.Component; | ||
| 21 | + | ||
| 22 | +import java.sql.Connection; | ||
| 23 | +import java.sql.PreparedStatement; | ||
| 24 | +import java.sql.ResultSet; | ||
| 25 | +import java.sql.SQLException; | ||
| 26 | +import java.text.ParseException; | ||
| 27 | +import java.text.SimpleDateFormat; | ||
| 28 | +import java.util.*; | ||
| 29 | + | ||
| 30 | +@Component | ||
| 31 | +public class OrderListThread extends Thread{ | ||
| 32 | + | ||
| 33 | + @Autowired | ||
| 34 | + ScheduleRealInfoRepository scheduleRealInfoRepository; | ||
| 35 | + | ||
| 36 | + @Autowired | ||
| 37 | + Ordehttp ordehttp; | ||
| 38 | + @Autowired | ||
| 39 | + DayOfSchedule dayOfSchedule; | ||
| 40 | + @Autowired | ||
| 41 | + LineService lineService; | ||
| 42 | + @Autowired | ||
| 43 | + ScheduleRealInfoService scheduleRealInfoService; | ||
| 44 | + | ||
| 45 | + @Autowired | ||
| 46 | + SendUtils sendUtils; | ||
| 47 | + | ||
| 48 | + static Logger logger = LoggerFactory.getLogger(OrderListThread.class); | ||
| 49 | + static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | ||
| 50 | + private static DateTimeFormatter fmtyyyy = DateTimeFormat.forPattern("yyyy"); | ||
| 51 | + | ||
| 52 | + private static DateTimeFormatter hhmm = DateTimeFormat.forPattern("HH:mm"); | ||
| 53 | + | ||
| 54 | + | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public void run() { | ||
| 58 | + savOderAll(); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + | ||
| 62 | + //做一个外部接口 后面方面直接调度 | ||
| 63 | + public void savOderAll(){ | ||
| 64 | + | ||
| 65 | + | ||
| 66 | + String token = ordehttp.Orderlogin(); | ||
| 67 | + List<Map> list = ordehttp.OrderList(token); | ||
| 68 | + saveSch(list); | ||
| 69 | + System.out.println("响应式公交班次执行完毕"); | ||
| 70 | + | ||
| 71 | + /*List<TrackPoint> points = getTrackPoints("77S2D008", 1747703580000L, 1747713000000l); //测试里程使用 | ||
| 72 | + // 计算总里程 | ||
| 73 | + double totalMileage = Double.valueOf(String.format("%.1f", calculateTotalMileage(points))); | ||
| 74 | + System.out.println(totalMileage);*/ | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + | ||
| 78 | + | ||
| 79 | + public void saveSch(List<Map> list){ | ||
| 80 | + | ||
| 81 | + try { | ||
| 82 | + // 按时间排序 | ||
| 83 | + Collections.sort(list, new Orderfcsj()); | ||
| 84 | + | ||
| 85 | + //获取所有线路 | ||
| 86 | + Map<String, List> mapAll = new HashMap<>();//整合数据,线路->线路下订单 | ||
| 87 | + Map<String, String> lineMap = BasicData.lineCode2NameMap; | ||
| 88 | + //根据线路分组 | ||
| 89 | + for (Map.Entry<String, String> t : lineMap.entrySet()) { | ||
| 90 | + if (t.getValue().contains("随心订")) { | ||
| 91 | + List ls = new ArrayList(); | ||
| 92 | + for (Map m : list) { | ||
| 93 | + //同一线路并且订单结束 | ||
| 94 | + if (t.getValue().contains(m.get("AreaName").toString())) { | ||
| 95 | + if (Integer.parseInt(m.get("TravelStatus").toString()) == 3) | ||
| 96 | + ls.add(m); | ||
| 97 | + } | ||
| 98 | + } | ||
| 99 | + mapAll.put(t.getKey(), ls); | ||
| 100 | + } | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + Map<String, List> groupedMap = new HashMap<>(); | ||
| 104 | + //根据车辆分组 | ||
| 105 | + for (Map.Entry<String, List> t : mapAll.entrySet()) { | ||
| 106 | + List<Map> orXlList = t.getValue(); | ||
| 107 | + // 按照 clzbh 分组 | ||
| 108 | + for (Map item : orXlList) { | ||
| 109 | + String clzbh = BasicData.nbbmCompanyPlateMap.inverse().get(item.get("VehicleId").toString().replace("-","")); | ||
| 110 | + if (!groupedMap.containsKey(t.getKey()+"_"+clzbh)) { | ||
| 111 | + groupedMap.put(t.getKey()+"_"+clzbh, new ArrayList<>()); | ||
| 112 | + } | ||
| 113 | + item.put("lineCode",t.getKey()); | ||
| 114 | + groupedMap.get(t.getKey()+"_"+clzbh).add(item); | ||
| 115 | + } | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + List<ScheduleRealInfo> listadd = new ArrayList<>(); //需要添加的班次 | ||
| 119 | + //以车辆为key循环 | ||
| 120 | + for (Map.Entry<String, List> t : groupedMap.entrySet()) { | ||
| 121 | + List<Map> SchMap = new ArrayList<>();//最终要添加的整合班次 | ||
| 122 | + List<Map> orXlList = t.getValue(); //车辆下的list | ||
| 123 | + Map lsmap = new HashMap(); | ||
| 124 | + //以车辆编号查询是否有套跑的班次 | ||
| 125 | + int is = 0; //标记添加的结束时间 -- 不考虑合并班次 | ||
| 126 | + String lineCode = t.getKey().split("_")[0]; | ||
| 127 | + String clzbh = t.getKey().split("_")[1]; | ||
| 128 | + | ||
| 129 | + List<ScheduleRealInfo> clzbhschLists = dayOfSchedule.findByNbbm(clzbh); //车辆的所有班次 | ||
| 130 | + List<ScheduleRealInfo> clzbhschList = new ArrayList<>(); | ||
| 131 | + //去除添加的公交随心订班次 | ||
| 132 | + Iterator<ScheduleRealInfo> it = clzbhschLists.iterator(); | ||
| 133 | + while(it.hasNext()){ | ||
| 134 | + ScheduleRealInfo str = it.next(); | ||
| 135 | + if (str.getRemarks() != null && str.getRemarks().contains("随心订")) { | ||
| 136 | + //去除随心订的班次好判断 | ||
| 137 | + }else { | ||
| 138 | + clzbhschList.add(str); | ||
| 139 | + } | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + Collections.sort(clzbhschList , new ScheduleComparator.FCSJ()); | ||
| 143 | + | ||
| 144 | + | ||
| 145 | + //以车辆分组 | ||
| 146 | + for (int i = 0; i < orXlList.size(); i++) { | ||
| 147 | + Map m = orXlList.get(i); | ||
| 148 | + if (i < orXlList.size() - 1){ | ||
| 149 | + Map m1 = orXlList.get(i + 1); | ||
| 150 | + Long coleTime = sdf.parse(m.get("CloseTime").toString()).getTime(); | ||
| 151 | + Long dospathTime = sdf.parse(m1.get("DispatchTime").toString()).getTime(); | ||
| 152 | + for (ScheduleRealInfo clsc : clzbhschList){ | ||
| 153 | + //如果有套跑 分割班次作用 | ||
| 154 | + if (!clsc.getXlBm().equals(m.get("lineCode").toString())){ | ||
| 155 | + Long FcsjT = clsc.getFcsjT(); | ||
| 156 | + //判断 在上一班次结束和下一个班次开始时的空档期是否有别线路 | ||
| 157 | + //11:00 13:00 12> 11 ** 12 < 13 | ||
| 158 | + if (FcsjT > coleTime && FcsjT < dospathTime){ | ||
| 159 | + lsmap.put("startDate",sdf.parse(orXlList.get(is).get("DispatchTime").toString()).getTime()); //派单时间 | ||
| 160 | + lsmap.put("endDate", sdf.parse(m.get("CloseTime").toString()).getTime()); //行程结束时间 | ||
| 161 | + lsmap.put("CheckTime", sdf.parse(m.get("CheckTime").toString()).getTime()); //核销时间 | ||
| 162 | + lsmap.put("car_plate", clzbh); //车牌号 | ||
| 163 | + lsmap.put("jName", m.get("DriverName")); //驾驶员 | ||
| 164 | + lsmap.put("xl", m.get("AreaName"));//区域名称 | ||
| 165 | + lsmap.put("remark", "公交随心订闲时响应班次("+(i + 1 -is)+"个)");//区域名称 | ||
| 166 | + lsmap.put("num", (i + 1 -is));//区域名称 | ||
| 167 | + SchMap.add(lsmap); | ||
| 168 | + is = i + 1; | ||
| 169 | + lsmap = new HashMap(); | ||
| 170 | + } | ||
| 171 | + } | ||
| 172 | + } | ||
| 173 | + }else { | ||
| 174 | + lsmap.put("startDate", sdf.parse(orXlList.get(is).get("DispatchTime").toString()).getTime()); //派单时间 | ||
| 175 | + lsmap.put("endDate",sdf.parse(m.get("CloseTime").toString()).getTime()); //行程结束时间 | ||
| 176 | + lsmap.put("CheckTime", sdf.parse(m.get("CheckTime").toString()).getTime()); //核销时间 | ||
| 177 | + lsmap.put("car_plate", clzbh); //车牌号 | ||
| 178 | + lsmap.put("jName", m.get("DriverName")); //驾驶员 | ||
| 179 | + lsmap.put("xl", m.get("AreaName"));//区域名称 | ||
| 180 | + lsmap.put("remark", "公交随心订闲时响应班次("+(i + 1 -is)+"个)");//区域名称 | ||
| 181 | + lsmap.put("num", (i + 1 -is));//区域名称 | ||
| 182 | + SchMap.add(lsmap); | ||
| 183 | + } | ||
| 184 | + } | ||
| 185 | + | ||
| 186 | + //根据业务部提出新需求单独加一个方法,保证因各种因素导致的行程都能算上 | ||
| 187 | + //1.起点站终点站和上下班次对应 | ||
| 188 | + //2.订单-班次数量 同一起终点 派单时间3分钟以内合并成一个订单。 | ||
| 189 | + //3.实到时间改成下一班次的发车时间前10分钟。 | ||
| 190 | + //4.实发时间改成上一个班次发车后10分 | ||
| 191 | + for (Map lmp : SchMap) { | ||
| 192 | + Long startDate = Long.valueOf(lmp.get("startDate").toString()); | ||
| 193 | + Long endDate = Long.valueOf(lmp.get("endDate").toString()); | ||
| 194 | + Long CheckTime = Long.valueOf(lmp.get("CheckTime").toString()); | ||
| 195 | + int numOr = Integer.parseInt(lmp.get("num").toString()); | ||
| 196 | + //订单-班次数量 同一起终点 派单时间3分钟以内合并成一个订单。 | ||
| 197 | + for (int j = 1; j < orXlList.size();j++){ | ||
| 198 | + Map mpj1 = orXlList.get(j - 1); | ||
| 199 | + Map mpj2 = orXlList.get(j); | ||
| 200 | + Long coleTime1 = sdf.parse(mpj1.get("CloseTime").toString()).getTime(); | ||
| 201 | + Long coleTime2 = sdf.parse(mpj2.get("CloseTime").toString()).getTime(); | ||
| 202 | + Long dispathTime = sdf.parse(mpj2.get("DispatchTime").toString()).getTime(); | ||
| 203 | + if (startDate <= dispathTime && endDate >= coleTime2 && mpj1.get("EndName").equals(mpj2.get("EndName")) | ||
| 204 | + && coleTime2 >= (coleTime1 - (1 * 60 * 1000)) && coleTime2 <= (coleTime1 + (1 * 60 * 1000))){ | ||
| 205 | + numOr = numOr - 1; | ||
| 206 | + } | ||
| 207 | + } | ||
| 208 | + //合成一个订单修改备注 | ||
| 209 | + if (numOr != Integer.parseInt(lmp.get("num").toString())){ | ||
| 210 | + lmp.put("remark", "公交随心订闲时响应班次("+numOr+"个)");//区域名称 | ||
| 211 | + lmp.put("num", numOr);//区域名称 | ||
| 212 | + } | ||
| 213 | + | ||
| 214 | + | ||
| 215 | + //只有一辆车、可能会有多个班次 | ||
| 216 | + for (int i = 1; i < clzbhschList.size();i++){ | ||
| 217 | + //计算班次结束时间和下一班次开始时间 | ||
| 218 | + ScheduleRealInfo sc1 = clzbhschList.get(i - 1); | ||
| 219 | + ScheduleRealInfo sc2 = clzbhschList.get(i); | ||
| 220 | + //早上最后一班车的终点时间大于订单的起点时间 订单结束的后一班车的发车时间要大于订单结束时间 找到两个班次的区间值 | ||
| 221 | + //去除掉公交随心订的班次 | ||
| 222 | + if (sc1.getZdsjT() < CheckTime && sc2.getFcsjT() > endDate){ | ||
| 223 | + lmp.put("startDate",sc1.getZdsjT() + (10* 60 *1000)); | ||
| 224 | + lmp.put("endDate",sc2.getFcsjT() - (10* 60 *1000)); | ||
| 225 | + break; | ||
| 226 | + } | ||
| 227 | + //有可能没有直接添加 | ||
| 228 | + if (sc1.getZdsjT() > CheckTime && sc2.getFcsjT() < endDate){ | ||
| 229 | + lmp.put("startDate",sc1.getZdsjT() + (10* 60 *1000)); | ||
| 230 | + lmp.put("endDate",sc2.getFcsjT() - (10* 60 *1000)); | ||
| 231 | + break; | ||
| 232 | + } | ||
| 233 | + | ||
| 234 | + } | ||
| 235 | + } | ||
| 236 | + | ||
| 237 | + //当前线路班次 | ||
| 238 | + List<ScheduleRealInfo> schList = dayOfSchedule.findByLineCode(lineCode); | ||
| 239 | + Collections.sort(schList , new ScheduleComparator.FCSJ()); | ||
| 240 | + //对比现有班次② | ||
| 241 | + for (Map lmp : SchMap) { | ||
| 242 | + Boolean bcstatus = true; | ||
| 243 | + ScheduleRealInfo sch = new ScheduleRealInfo(); | ||
| 244 | + Long startTime = Long.valueOf(lmp.get("startDate").toString()) - (10 * 60 * 1000); | ||
| 245 | + Long startTime1 = Long.valueOf(lmp.get("startDate").toString()) + (10 * 60 *1000); | ||
| 246 | + String cl = lmp.get("car_plate").toString(); | ||
| 247 | + String LpName = null; | ||
| 248 | + for (ScheduleRealInfo sr : schList) { | ||
| 249 | + //范围内有已添加班次 -- 合并 | ||
| 250 | + //同一车辆,备注里响应式公交班次数相同 发车时间在这个班次的前后五分钟 | ||
| 251 | + if (cl.equals(sr.getClZbh()) && startTime <= sr.getFcsjT() && startTime1 >= sr.getFcsjT() && sr.getStatus() != -1 | ||
| 252 | + && sr.getRemarks() !=null && sr.getRemarks().contains("随心订")){ | ||
| 253 | + //不管有没有相同的班次数 重新计算一下里程 | ||
| 254 | + sch = SetSch(lmp, sr); | ||
| 255 | + listadd.add(sch); | ||
| 256 | + bcstatus = false; | ||
| 257 | + } | ||
| 258 | + if (cl.equals(sr.getClZbh())){ | ||
| 259 | + LpName = sr.getLpName(); | ||
| 260 | + } | ||
| 261 | + } | ||
| 262 | + //范围内无已添加班次 整合成可添加班次 | ||
| 263 | + //没有已有班次不判断直接填加① | ||
| 264 | + if (bcstatus) { | ||
| 265 | + sch = addSch(lmp, lineCode,LpName); | ||
| 266 | + listadd.add(sch); | ||
| 267 | + } | ||
| 268 | + } | ||
| 269 | + } | ||
| 270 | + | ||
| 271 | + | ||
| 272 | + //查询轨迹 -- 计算g公里 | ||
| 273 | + for (ScheduleRealInfo sc : listadd) { | ||
| 274 | + String device = BasicData.deviceId2NbbmMap.inverse().get(sc.getClZbh()); | ||
| 275 | + if (sc.getFcsjActual() != null && sc.getZdsjActual() != null) { | ||
| 276 | + List<TrackPoint> points = getTrackPoints(device, sc.getFcsjActualTime(), sc.getZdsjActualTime()); | ||
| 277 | + // 计算总里程 | ||
| 278 | + double totalMileage = Double.valueOf(String.format("%.1f", calculateTotalMileage(points))); | ||
| 279 | + if (totalMileage != 0) | ||
| 280 | + sc.setJhlc(totalMileage); | ||
| 281 | + //里程没问题添加班次 | ||
| 282 | + if (sc.getId() == null) { | ||
| 283 | + Map<String, Object> k = scheduleRealInfoService.saveSch(sc); | ||
| 284 | + logger.info("班次添加情况----"+k.get("msg")); //nullshi添加成功 | ||
| 285 | + sendUtils.refreshaddSch(k,sc.getXlBm()); | ||
| 286 | + } else {//修改班次 | ||
| 287 | + dayOfSchedule.save(sc); | ||
| 288 | + //刷新班次 | ||
| 289 | + sendUtils.refreshSch(sc); | ||
| 290 | + } | ||
| 291 | + | ||
| 292 | + } | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + | ||
| 296 | + | ||
| 297 | + | ||
| 298 | + }catch (Exception e){ | ||
| 299 | + logger.error("添加班次异常-",e); | ||
| 300 | + } | ||
| 301 | + | ||
| 302 | + } | ||
| 303 | + | ||
| 304 | + /** | ||
| 305 | + * 整合班次 sch | ||
| 306 | + * @param map | ||
| 307 | + * @param lineName | ||
| 308 | + * @throws Exception | ||
| 309 | + */ | ||
| 310 | + public ScheduleRealInfo addSch (Map map,String lineCode,String LpName) { | ||
| 311 | + | ||
| 312 | + ScheduleRealInfo sch = new ScheduleRealInfo(); | ||
| 313 | + try { | ||
| 314 | + Line line = lineService.findByLineCode(lineCode); | ||
| 315 | + Long dispatchTime = Long.valueOf(map.get("startDate").toString()); | ||
| 316 | + Long closeTime = Long.valueOf(map.get("endDate").toString()); | ||
| 317 | + | ||
| 318 | + List<StationRoute> list = GeoCacheData.getStationRoute(lineCode, 0); | ||
| 319 | + | ||
| 320 | + String clzbh = map.get("car_plate").toString(); | ||
| 321 | + String jName = map.get("jName").toString(); | ||
| 322 | + String jGh = null; | ||
| 323 | + Map<String, String> allpersion = BasicData.allPerson; //所有人员 | ||
| 324 | + for (String key : allpersion.keySet()) { | ||
| 325 | + if (jName.equals(allpersion.get(key))) { | ||
| 326 | + //加上判断临港公交 避免另外公司重名 | ||
| 327 | + jGh = key.split("-")[1]; | ||
| 328 | + } | ||
| 329 | + } | ||
| 330 | + | ||
| 331 | + //公司 和 分公司名称 | ||
| 332 | + sch.setGsBm(line.getCompany()); | ||
| 333 | + sch.setFgsBm(line.getBrancheCompany()); | ||
| 334 | + sch.setBcType("normal"); | ||
| 335 | + sch.setXlBm(lineCode); | ||
| 336 | + sch.setXlName(line.getName()); | ||
| 337 | + sch.setLpName(LpName !=null ? LpName : "临1");//临加路牌 | ||
| 338 | + sch.setClZbh(clzbh); | ||
| 339 | + sch.setjGh(jGh); | ||
| 340 | + sch.setjName(jName); | ||
| 341 | + sch.setXlDir("0"); | ||
| 342 | + sch.setQdzCode(list.get(0).getCode()); //首站 | ||
| 343 | + sch.setZdzCode(list.get(0).getCode()); //末站 | ||
| 344 | + sch.setDfsjAll(dispatchTime); | ||
| 345 | + sch.setFcsjAll(dispatchTime); | ||
| 346 | + sch.setZdsj(hhmm.print(closeTime)); | ||
| 347 | + sch.setZdsjT(closeTime); | ||
| 348 | + sch.setFcsjActualAll(dispatchTime); | ||
| 349 | + sch.setZdsjActualAll(closeTime); | ||
| 350 | + sch.setRemarks(map.get("remark").toString()); | ||
| 351 | + }catch (Exception e){ | ||
| 352 | + logger.error("转换sch异常--",e); | ||
| 353 | + } | ||
| 354 | + | ||
| 355 | + return sch; | ||
| 356 | + } | ||
| 357 | + | ||
| 358 | + | ||
| 359 | + | ||
| 360 | + public ScheduleRealInfo SetSch (Map map,ScheduleRealInfo sch) { | ||
| 361 | + | ||
| 362 | + try { | ||
| 363 | + //初始到站时间直接到下一班次10分钟之前了 不用在修改班次了 | ||
| 364 | + /*Long closeTime = Long.parseLong(map.get("endDate").toString()); | ||
| 365 | + sch.setZdsj(hhmm.print(closeTime)); | ||
| 366 | + sch.setZdsjActualAll(closeTime);*/ | ||
| 367 | + sch.setRemarks(map.get("remark").toString()); | ||
| 368 | + }catch (Exception e){ | ||
| 369 | + logger.error("转换sch异常--",e); | ||
| 370 | + } | ||
| 371 | + | ||
| 372 | + return sch; | ||
| 373 | + } | ||
| 374 | + | ||
| 375 | + public List<TrackPoint> getTrackPoints(String device, Long startTime, Long endTime) { | ||
| 376 | + List<TrackPoint> points = new ArrayList<>(); | ||
| 377 | + | ||
| 378 | + //按年分表 | ||
| 379 | + String tableName = "bsth_c_gps_info_" + fmtyyyy.print(startTime); | ||
| 380 | + Calendar sCal = Calendar.getInstance(); | ||
| 381 | + sCal.setTime(new Date(startTime)); | ||
| 382 | + Calendar eCal = Calendar.getInstance(); | ||
| 383 | + eCal.setTime(new Date(endTime)); | ||
| 384 | + | ||
| 385 | + int sDayOfYear = sCal.get(Calendar.DAY_OF_YEAR);//获取当前是今年的第几天。 | ||
| 386 | + int eDayOfYear = eCal.get(Calendar.DAY_OF_YEAR); | ||
| 387 | + String sql = "select DEVICE_ID,LON,LAT,TS,INOUT_STOP,SERVICE_STATE ,STOP_NO,DIRECTION,LINE_ID,SPEED_GPS,SECTION_CODE from "+tableName+" where days_year in ("+sDayOfYear+","+eDayOfYear+") " + | ||
| 388 | + " and device_id='"+device+"' and ts >= "+startTime+" and ts <= "+endTime+" "; | ||
| 389 | + | ||
| 390 | + Connection conn = null; | ||
| 391 | + PreparedStatement ps = null; | ||
| 392 | + ResultSet rs = null; | ||
| 393 | + try{ | ||
| 394 | + conn= DBUtils_MS.getConnection(); | ||
| 395 | + ps = conn.prepareStatement(sql); | ||
| 396 | + rs = ps.executeQuery(); | ||
| 397 | + //GPS84坐标 | ||
| 398 | + while (rs.next()) { | ||
| 399 | + double lat = rs.getDouble("LAT"); | ||
| 400 | + double lon = rs.getDouble("LON"); | ||
| 401 | + Long timestamp = rs.getLong("TS"); | ||
| 402 | + points.add(new TrackPoint(lat, lon, timestamp)); | ||
| 403 | + } | ||
| 404 | + }catch (SQLException e) { | ||
| 405 | + e.printStackTrace(); | ||
| 406 | + }finally { | ||
| 407 | + DBUtils_MS.close(rs, ps, conn); | ||
| 408 | + } | ||
| 409 | + return points; | ||
| 410 | + } | ||
| 411 | + | ||
| 412 | + | ||
| 413 | + public static class Orderfcsj implements Comparator<Map> { | ||
| 414 | + @Override | ||
| 415 | + public int compare(Map o1, Map o2) { | ||
| 416 | + try { | ||
| 417 | + return (int) (sdf.parse(o1.get("OrderTime").toString()).getTime() - sdf.parse(o2.get("OrderTime").toString()).getTime()); | ||
| 418 | + } catch (ParseException e) { | ||
| 419 | + logger.error("tt", e); | ||
| 420 | + } | ||
| 421 | + return 0; | ||
| 422 | + } | ||
| 423 | + } | ||
| 424 | + | ||
| 425 | + //使用Haversine公式计算两个经纬度点之间的距离。 | ||
| 426 | + | ||
| 427 | + private final double EARTH_RADIUS_KM = 6371.0; // 地球半径(千米) | ||
| 428 | + | ||
| 429 | + public double calculateDistance(TrackPoint p1, TrackPoint p2) { | ||
| 430 | + double lat1 = Math.toRadians(p1.getLatitude()); | ||
| 431 | + double lon1 = Math.toRadians(p1.getLongitude()); | ||
| 432 | + double lat2 = Math.toRadians(p2.getLatitude()); | ||
| 433 | + double lon2 = Math.toRadians(p2.getLongitude()); | ||
| 434 | + | ||
| 435 | + double dLat = lat2 - lat1; | ||
| 436 | + double dLon = lon2 - lon1; | ||
| 437 | + | ||
| 438 | + double a = Math.sin(dLat / 2) * Math.sin(dLat / 2) | ||
| 439 | + + Math.cos(lat1) * Math.cos(lat2) | ||
| 440 | + * Math.sin(dLon / 2) * Math.sin(dLon / 2); | ||
| 441 | + double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); | ||
| 442 | + | ||
| 443 | + return EARTH_RADIUS_KM * c; | ||
| 444 | + } | ||
| 445 | + | ||
| 446 | + | ||
| 447 | + | ||
| 448 | + public double calculateTotalMileage(List<TrackPoint> points) { | ||
| 449 | + if (points == null || points.size() < 2) { | ||
| 450 | + return 0.0; | ||
| 451 | + } | ||
| 452 | + | ||
| 453 | + double totalMileage = 0.0; | ||
| 454 | + for (int i = 1; i < points.size(); i++) { | ||
| 455 | + TrackPoint prev = points.get(i - 1); | ||
| 456 | + TrackPoint current = points.get(i); | ||
| 457 | + totalMileage += calculateDistance(prev, current); | ||
| 458 | + } | ||
| 459 | + return totalMileage; | ||
| 460 | + } | ||
| 461 | + class TrackPoint { | ||
| 462 | + private double latitude; // 纬度 | ||
| 463 | + private double longitude; // 经度 | ||
| 464 | + private Long timestamp; // 时间戳 | ||
| 465 | + | ||
| 466 | + // 构造方法、Getter和Setter | ||
| 467 | + public TrackPoint(double latitude, double longitude, Long timestamp) { | ||
| 468 | + this.latitude = latitude; | ||
| 469 | + this.longitude = longitude; | ||
| 470 | + this.timestamp = timestamp; | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + public double getLatitude() { | ||
| 474 | + return latitude; | ||
| 475 | + } | ||
| 476 | + | ||
| 477 | + public void setLatitude(double latitude) { | ||
| 478 | + this.latitude = latitude; | ||
| 479 | + } | ||
| 480 | + | ||
| 481 | + public double getLongitude() { | ||
| 482 | + return longitude; | ||
| 483 | + } | ||
| 484 | + | ||
| 485 | + public void setLongitude(double longitude) { | ||
| 486 | + this.longitude = longitude; | ||
| 487 | + } | ||
| 488 | + | ||
| 489 | + public Long getTimestamp() { | ||
| 490 | + return timestamp; | ||
| 491 | + } | ||
| 492 | + | ||
| 493 | + public void setTimestamp(Long timestamp) { | ||
| 494 | + this.timestamp = timestamp; | ||
| 495 | + } | ||
| 496 | + } | ||
| 497 | + | ||
| 498 | +} |
src/main/java/com/bsth/data/zndd/voice/GJC.java
| @@ -18,7 +18,9 @@ public enum GJC { | @@ -18,7 +18,9 @@ public enum GJC { | ||
| 18 | GB(9, "关闭"), | 18 | GB(9, "关闭"), |
| 19 | ge(10, "一个"), | 19 | ge(10, "一个"), |
| 20 | dao(11, "到"), | 20 | dao(11, "到"), |
| 21 | - de(12, "的班次"); | 21 | + de(12, "的班次"), |
| 22 | + | ||
| 23 | + jc(13, "进场"); | ||
| 22 | 24 | ||
| 23 | private int code; | 25 | private int code; |
| 24 | private String description; | 26 | private String description; |
src/main/java/com/bsth/data/zndd/voice/UploadVideoServlet.java
| @@ -166,15 +166,19 @@ public class UploadVideoServlet extends HttpServlet { | @@ -166,15 +166,19 @@ public class UploadVideoServlet extends HttpServlet { | ||
| 166 | 166 | ||
| 167 | 167 | ||
| 168 | if(text.contains("轨迹")){ | 168 | if(text.contains("轨迹")){ |
| 169 | - writer.write(text+"_"+ZL.LJCCBC.getDescription()+",66"); | 169 | + writer.write(text+",66"); |
| 170 | return; | 170 | return; |
| 171 | } | 171 | } |
| 172 | if(isSimilarity(ZL.LJCCBC,text,null) || text.contains("出场")){//添加出厂班次 | 172 | if(isSimilarity(ZL.LJCCBC,text,null) || text.contains("出场")){//添加出厂班次 |
| 173 | writer.write(text+"_"+ZL.LJCCBC.getDescription()+",2"); | 173 | writer.write(text+"_"+ZL.LJCCBC.getDescription()+",2"); |
| 174 | return; | 174 | return; |
| 175 | } | 175 | } |
| 176 | + if(isSimilarity(ZL.LJJCBC,text,null) || text.contains("进场")){//添加进场班次 | ||
| 177 | + writer.write(text+"_"+ZL.LJJCBC.getDescription()+",3"); | ||
| 178 | + return; | ||
| 179 | + } | ||
| 176 | if(isSimilarity(ZL.LJBC,text,null)){//添加班次 | 180 | if(isSimilarity(ZL.LJBC,text,null)){//添加班次 |
| 177 | - writer.write(text+"_"+ZL.LJBC.getDescription()+",3"); | 181 | + writer.write(text+"_"+ZL.LJBC.getDescription()+",4"); |
| 178 | return; | 182 | return; |
| 179 | } | 183 | } |
| 180 | if(isSimilarity(ZL.QXBC,text,null)){//取消班次 | 184 | if(isSimilarity(ZL.QXBC,text,null)){//取消班次 |
src/main/java/com/bsth/data/zndd/voice/ZL.java
| @@ -9,6 +9,8 @@ import java.util.Set; | @@ -9,6 +9,8 @@ import java.util.Set; | ||
| 9 | public enum ZL { | 9 | public enum ZL { |
| 10 | LJBC(new Integer[]{2,4}, "临加班次"), | 10 | LJBC(new Integer[]{2,4}, "临加班次"), |
| 11 | LJCCBC(new Integer[]{2,4,7}, "临加出场班次"), | 11 | LJCCBC(new Integer[]{2,4,7}, "临加出场班次"), |
| 12 | + | ||
| 13 | + LJJCBC(new Integer[]{2,4,13}, "临加进场班次"), | ||
| 12 | TZDF(new Integer[]{3,5}, "调整待发"), | 14 | TZDF(new Integer[]{3,5}, "调整待发"), |
| 13 | TZSF(new Integer[]{3,6}, "调整实发"), | 15 | TZSF(new Integer[]{3,6}, "调整实发"), |
| 14 | QXBC(new Integer[]{1,4}, "取消班次"), | 16 | QXBC(new Integer[]{1,4}, "取消班次"), |
src/main/java/com/bsth/filter/BaseFilter.java
| @@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter { | @@ -20,7 +20,7 @@ public abstract class BaseFilter implements Filter { | ||
| 20 | Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, | 20 | Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, Constants.LOGIN_FAILURE, |
| 21 | Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, | 21 | Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.XD_REAL_GPS, Constants.UP_RFID_URL, |
| 22 | Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, | 22 | Constants.STATION_AND_SECTION_COUNT, Constants.ACTUATOR_MANAGEMENT_HEALTH, Constants.VEHICLE_DATA_SYNC_URL, |
| 23 | - Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL}; | 23 | + Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL}; |
| 24 | 24 | ||
| 25 | @Override | 25 | @Override |
| 26 | public void destroy() { | 26 | public void destroy() { |
src/main/java/com/bsth/security/WebSecurityConfig.java
| @@ -39,7 +39,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | @@ -39,7 +39,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter { | ||
| 39 | // 白名单 | 39 | // 白名单 |
| 40 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ORIGINAL_LOGIN_PAGE, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, | 40 | web.ignoring().antMatchers(Constants.LOGIN_PAGE, Constants.LOGIN, Constants.ORIGINAL_LOGIN_PAGE, Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.CAPTCHA, |
| 41 | Constants.SERVICE_INTERFACE, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, | 41 | Constants.SERVICE_INTERFACE, Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, |
| 42 | - Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL); | 42 | + Constants.UP_RFID_URL, Constants.STATION_AND_SECTION_COUNT, Constants.FILE_AUTH,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | @Override | 45 | @Override |
src/main/java/com/bsth/security/filter/LoginInterceptor.java
| @@ -35,7 +35,7 @@ public class LoginInterceptor implements Filter { | @@ -35,7 +35,7 @@ public class LoginInterceptor implements Filter { | ||
| 35 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.ORIGINAL_LOGIN_PAGE, Constants.SERVICE_INTERFACE, | 35 | private String[] whiteListURLs = { Constants.LOGIN_PAGE,Constants.CAPTCHA, Constants.ORIGINAL_LOGIN_PAGE, Constants.SERVICE_INTERFACE, |
| 36 | Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, | 36 | Constants.ASSETS_URL, Constants.FAVICON_URL, Constants.LOGIN, |
| 37 | Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL, | 37 | Constants.LOGIN_FAILURE, Constants.UPSTREAM_URL, Constants.XD_CHILD_PAGES, Constants.UP_RFID_URL, |
| 38 | - Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH ,Constants.OUT_URL,Constants.NOTICE_URL}; | 38 | + Constants.STATION_AND_SECTION_COUNT, Constants.VEHICLE_DATA_SYNC_URL, Constants.FILE_AUTH ,Constants.OUT_URL,Constants.NOTICE_URL,Constants.DIFYINTER_URL}; |
| 39 | 39 | ||
| 40 | 40 | ||
| 41 | @Override | 41 | @Override |
src/main/java/com/bsth/service/realcontrol/ScheduleRealInfoService.java
| @@ -210,4 +210,6 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | @@ -210,4 +210,6 @@ public interface ScheduleRealInfoService extends BaseService<ScheduleRealInfo, L | ||
| 210 | 210 | ||
| 211 | List<ScheduleRealInfo> findAllSchDate(String schDate); | 211 | List<ScheduleRealInfo> findAllSchDate(String schDate); |
| 212 | 212 | ||
| 213 | + Map<String, Object> saveSch(ScheduleRealInfo sc); | ||
| 214 | + | ||
| 213 | } | 215 | } |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| @@ -7010,6 +7010,120 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | @@ -7010,6 +7010,120 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf | ||
| 7010 | return scheduleRealInfoRepository.findAllSchDate(schDate); | 7010 | return scheduleRealInfoRepository.findAllSchDate(schDate); |
| 7011 | } | 7011 | } |
| 7012 | 7012 | ||
| 7013 | + /** | ||
| 7014 | + * 临加班次 --响应式公交使用 | ||
| 7015 | + */ | ||
| 7016 | + @Override | ||
| 7017 | + public Map<String, Object> saveSch(ScheduleRealInfo sch) { | ||
| 7018 | + Map<String, Object> rs = new HashMap<>(); | ||
| 7019 | + try { | ||
| 7020 | + String clZbh = sch.getClZbh(), lpName = sch.getLpName(); | ||
| 7021 | + if (StringUtils.isEmpty(lpName) || StringUtils.isEmpty(lpName.trim())) { | ||
| 7022 | + rs.put("status", ResponseCode.ERROR); | ||
| 7023 | + rs.put("msg", "路牌信息缺失"); | ||
| 7024 | + return rs; | ||
| 7025 | + } | ||
| 7026 | + if (StringUtils.isNotEmpty(clZbh)) { | ||
| 7027 | + //检测 | ||
| 7028 | + if (!carExist(sch.getGsBm(), clZbh)) { | ||
| 7029 | + rs.put("status", ResponseCode.ERROR); | ||
| 7030 | + rs.put("msg", "车辆 " + clZbh + " 不存在!"); | ||
| 7031 | + return rs; | ||
| 7032 | + } else if (!sch.getGsBm().equals(BasicData.nbbm2CompanyCodeMap.get(clZbh))) { | ||
| 7033 | + rs.put("status", ResponseCode.ERROR); | ||
| 7034 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到自编号为【" + clZbh + "】的车辆"); | ||
| 7035 | + return rs; | ||
| 7036 | + } | ||
| 7037 | + } | ||
| 7038 | + | ||
| 7039 | + //SysUser user = SecurityUtils.getCurrentUser(); | ||
| 7040 | + String schDate = DayOfSchedule.currSchDateMap.get(sch.getXlBm()); | ||
| 7041 | + | ||
| 7042 | + SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"), sdfyyyyMMddHHmm = new SimpleDateFormat("yyyy-MM-ddHH:mm"); | ||
| 7043 | + | ||
| 7044 | + if (StringUtils.isEmpty(sch.getjGh())) { | ||
| 7045 | + rs.put("status", ResponseCode.ERROR); | ||
| 7046 | + rs.put("msg", "驾驶员工号不能为空!"); | ||
| 7047 | + return rs; | ||
| 7048 | + } | ||
| 7049 | + //截取驾驶员工号 | ||
| 7050 | + if (sch.getjGh().indexOf("-") != -1) { | ||
| 7051 | + sch.setjGh(sch.getjGh().split("-")[1]); | ||
| 7052 | + } | ||
| 7053 | + //检查驾驶员工号 | ||
| 7054 | + String jName = getPersonName(sch.getGsBm(), sch.getjGh()); | ||
| 7055 | + if (StringUtils.isEmpty(jName)) { | ||
| 7056 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的驾驶员"); | ||
| 7057 | + rs.put("status", ResponseCode.ERROR); | ||
| 7058 | + return rs; | ||
| 7059 | + } else if (StringUtils.isEmpty(sch.getjName())) { | ||
| 7060 | + sch.setjName(jName);//补上驾驶员名称 | ||
| 7061 | + } | ||
| 7062 | + | ||
| 7063 | + //有售票员 | ||
| 7064 | + if (StringUtils.isNotEmpty(sch.getsGh())) { | ||
| 7065 | + String sName = getPersonName(sch.getGsBm(), sch.getsGh()); | ||
| 7066 | + if (StringUtils.isEmpty(sName)) { | ||
| 7067 | + rs.put("msg", sch.getXlName() + "所属的公司编码下找不到工号为【" + sch.getjGh() + "】的售票员"); | ||
| 7068 | + rs.put("status", ResponseCode.ERROR); | ||
| 7069 | + return rs; | ||
| 7070 | + } else if (StringUtils.isEmpty(sch.getsName())) { | ||
| 7071 | + sch.setsName(sName);//补上售票员名称 | ||
| 7072 | + } | ||
| 7073 | + } else { | ||
| 7074 | + sch.setsGh(""); | ||
| 7075 | + sch.setsName(""); | ||
| 7076 | + } | ||
| 7077 | + | ||
| 7078 | + //公司 和 分公司名称 | ||
| 7079 | + sch.setGsName(BasicData.businessCodeNameMap.get(sch.getGsBm())); | ||
| 7080 | + sch.setFgsName(BasicData.businessFgsCodeNameMap.get(sch.getFgsBm() + "_" + sch.getGsBm())); | ||
| 7081 | + sch.setCreateDate(new Date()); | ||
| 7082 | + sch.setScheduleDateStr(schDate); | ||
| 7083 | + sch.setScheduleDate(sdfyyyyMMdd.parse(schDate)); | ||
| 7084 | + sch.setRealExecDate(schDate); | ||
| 7085 | + | ||
| 7086 | + sch.setSflj(true); | ||
| 7087 | + sch.setLate(false); | ||
| 7088 | + sch.setDfsj(sch.getFcsj()); | ||
| 7089 | + sch.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + sch.getZdsj()).getTime()); | ||
| 7090 | + sch.setJhlcOrig(sch.getJhlc()); | ||
| 7091 | + sch.setCreateDate(new Date()); | ||
| 7092 | + sch.setUpdateDate(new Date()); | ||
| 7093 | + sch.setSpId(-1L); | ||
| 7094 | + //起终点名称 | ||
| 7095 | + String prefix = sch.getXlBm() + "_" + sch.getXlDir() + "_"; | ||
| 7096 | + sch.setQdzName(BasicData.getStationNameByCode(sch.getQdzCode(), prefix)); | ||
| 7097 | + sch.setZdzName(BasicData.getStationNameByCode(sch.getZdzCode(), prefix)); | ||
| 7098 | + | ||
| 7099 | + | ||
| 7100 | + //班次历时 | ||
| 7101 | + sch.setBcsj((int) ((sch.getZdsjT() - sch.getDfsjT()) / 1000 / 60)); | ||
| 7102 | + if (sch.getZdsjT() < sch.getFcsjT()) { | ||
| 7103 | + rs.put("status", ResponseCode.ERROR); | ||
| 7104 | + rs.put("msg", "起终点时间异常!"); | ||
| 7105 | + return rs; | ||
| 7106 | + } | ||
| 7107 | + | ||
| 7108 | + sch.setId(dayOfSchedule.getId()); | ||
| 7109 | + //实时入库 | ||
| 7110 | + super.save(sch); | ||
| 7111 | + | ||
| 7112 | + // 加入缓存 | ||
| 7113 | + dayOfSchedule.put(sch); | ||
| 7114 | + | ||
| 7115 | + //更新起点应到时间 | ||
| 7116 | + List<ScheduleRealInfo> ts =new ArrayList<>(); | ||
| 7117 | + rs.put("ts", ts); | ||
| 7118 | + rs.put("t", sch); | ||
| 7119 | + } catch (Exception e) { | ||
| 7120 | + logger.error("", e); | ||
| 7121 | + rs.put("status", ResponseCode.ERROR); | ||
| 7122 | + } | ||
| 7123 | + return rs; | ||
| 7124 | + } | ||
| 7125 | + | ||
| 7126 | + | ||
| 7013 | @Override | 7127 | @Override |
| 7014 | public void afterPropertiesSet() throws Exception { | 7128 | public void afterPropertiesSet() throws Exception { |
| 7015 | // TODO Auto-generated method stub | 7129 | // TODO Auto-generated method stub |
src/main/java/com/bsth/service/zndd/LoggerZnddService.java
| @@ -28,6 +28,10 @@ public interface LoggerZnddService extends BaseService<LoggerZndd, Integer> { | @@ -28,6 +28,10 @@ public interface LoggerZnddService extends BaseService<LoggerZndd, Integer> { | ||
| 28 | 28 | ||
| 29 | Map schDeepSeep(String message); | 29 | Map schDeepSeep(String message); |
| 30 | 30 | ||
| 31 | + String line_yd(String message); | ||
| 32 | + | ||
| 31 | List<ScheduleRealInfo> schQbc(String xl); | 33 | List<ScheduleRealInfo> schQbc(String xl); |
| 32 | 34 | ||
| 35 | + List line_zd(String message); | ||
| 36 | + | ||
| 33 | } | 37 | } |
src/main/java/com/bsth/service/zndd/impl/LoggerZnddServiceImpl.java
| @@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSON; | @@ -4,9 +4,12 @@ import com.alibaba.fastjson.JSON; | ||
| 4 | import com.bsth.common.ResponseCode; | 4 | import com.bsth.common.ResponseCode; |
| 5 | import com.bsth.controller.realcontrol.dto.DfsjChange; | 5 | import com.bsth.controller.realcontrol.dto.DfsjChange; |
| 6 | import com.bsth.data.BasicData; | 6 | import com.bsth.data.BasicData; |
| 7 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | ||
| 8 | +import com.bsth.data.gpsdata_v2.entity.StationRoute; | ||
| 7 | import com.bsth.data.schedule.DayOfSchedule; | 9 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | import com.bsth.data.schedule.ScheduleComparator; | 10 | import com.bsth.data.schedule.ScheduleComparator; |
| 9 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | 11 | import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; |
| 12 | +import com.bsth.data.zndd.dify.BusCongestionChecker; | ||
| 10 | import com.bsth.entity.Line; | 13 | import com.bsth.entity.Line; |
| 11 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 14 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 12 | import com.bsth.entity.sys.RealControAuthority; | 15 | import com.bsth.entity.sys.RealControAuthority; |
| @@ -19,6 +22,7 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService; | @@ -19,6 +22,7 @@ import com.bsth.service.realcontrol.ScheduleRealInfoService; | ||
| 19 | import com.bsth.service.report.ReportService; | 22 | import com.bsth.service.report.ReportService; |
| 20 | import com.bsth.service.sys.RealControAuthorityService; | 23 | import com.bsth.service.sys.RealControAuthorityService; |
| 21 | import com.bsth.service.zndd.LoggerZnddService; | 24 | import com.bsth.service.zndd.LoggerZnddService; |
| 25 | +import com.bsth.util.CoordinateConverter; | ||
| 22 | import com.bsth.util.DateUtils; | 26 | import com.bsth.util.DateUtils; |
| 23 | import com.bsth.util.ReportUtils; | 27 | import com.bsth.util.ReportUtils; |
| 24 | import org.slf4j.Logger; | 28 | import org.slf4j.Logger; |
| @@ -27,10 +31,14 @@ import org.springframework.beans.factory.annotation.Autowired; | @@ -27,10 +31,14 @@ import org.springframework.beans.factory.annotation.Autowired; | ||
| 27 | import org.springframework.data.domain.Sort; | 31 | import org.springframework.data.domain.Sort; |
| 28 | import org.springframework.jdbc.core.BeanPropertyRowMapper; | 32 | import org.springframework.jdbc.core.BeanPropertyRowMapper; |
| 29 | import org.springframework.jdbc.core.JdbcTemplate; | 33 | import org.springframework.jdbc.core.JdbcTemplate; |
| 34 | +import org.springframework.jdbc.core.RowMapper; | ||
| 30 | import org.springframework.stereotype.Service; | 35 | import org.springframework.stereotype.Service; |
| 31 | import org.springframework.transaction.annotation.Transactional; | 36 | import org.springframework.transaction.annotation.Transactional; |
| 32 | import org.springframework.web.bind.annotation.RequestParam; | 37 | import org.springframework.web.bind.annotation.RequestParam; |
| 33 | 38 | ||
| 39 | +import java.math.BigDecimal; | ||
| 40 | +import java.sql.ResultSet; | ||
| 41 | +import java.sql.SQLException; | ||
| 34 | import java.text.SimpleDateFormat; | 42 | import java.text.SimpleDateFormat; |
| 35 | import java.time.LocalTime; | 43 | import java.time.LocalTime; |
| 36 | import java.time.format.DateTimeFormatter; | 44 | import java.time.format.DateTimeFormatter; |
| @@ -59,6 +67,8 @@ public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> | @@ -59,6 +67,8 @@ public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> | ||
| 59 | Logger logger = LoggerFactory.getLogger(this.getClass()); | 67 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 60 | private static SimpleDateFormat sdfMonth = new SimpleDateFormat("HH:mm"); | 68 | private static SimpleDateFormat sdfMonth = new SimpleDateFormat("HH:mm"); |
| 61 | private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); | 69 | private static SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); |
| 70 | + | ||
| 71 | + private static SimpleDateFormat yyyyMMdd = new SimpleDateFormat("yyyy-MM-dd"); | ||
| 62 | public List<Map<String, Object>> listAll(Map<String, Object> map){ | 72 | public List<Map<String, Object>> listAll(Map<String, Object> map){ |
| 63 | loggerZnddRepository.findAll((Sort) map); | 73 | loggerZnddRepository.findAll((Sort) map); |
| 64 | 74 | ||
| @@ -411,4 +421,208 @@ public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> | @@ -411,4 +421,208 @@ public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> | ||
| 411 | 421 | ||
| 412 | return list; | 422 | return list; |
| 413 | } | 423 | } |
| 424 | + | ||
| 425 | + //获取道路是否拥堵 | ||
| 426 | + public String line_yd(String message) { | ||
| 427 | + String fyString = ""; | ||
| 428 | + String xl = null; //线路编码 | ||
| 429 | + String xlName = null; //查询出线路 | ||
| 430 | + Line line = null; | ||
| 431 | + //起点坐标 ,终点坐标,起点名称,终点名称 | ||
| 432 | + String ORIGIN = "", DESTINATION = "",orStationName = null,descStationName= null; | ||
| 433 | + //获取所有线路 | ||
| 434 | + Map<String, String> lineMap = BasicData.lineCode2NameMap; | ||
| 435 | + for (Map.Entry<String, String> t : lineMap.entrySet()) { | ||
| 436 | + if (message.contains(t.getValue()) || t.getValue().contains(message)) { | ||
| 437 | + xl = t.getKey(); | ||
| 438 | + xlName = t.getValue(); | ||
| 439 | + } | ||
| 440 | + } | ||
| 441 | + if (xl != null) { | ||
| 442 | + List<StationRoute> list = GeoCacheData.getStationRoute(xl, 0); | ||
| 443 | + for (StationRoute sr :list){ | ||
| 444 | + CoordinateConverter.Location location; | ||
| 445 | + location = CoordinateConverter.LocationMake(sr.getPoint().getLon(), sr.getPoint().getLat()); | ||
| 446 | + location = CoordinateConverter.bd_encrypt(CoordinateConverter.transformFromWGSToGCJ(location)); | ||
| 447 | + if(sr.getMark().equals("B")) { | ||
| 448 | + ORIGIN = location.getLat() + "," + location.getLng(); | ||
| 449 | + orStationName = sr.getName(); | ||
| 450 | + } | ||
| 451 | + | ||
| 452 | + if(sr.getMark().equals("E")) { | ||
| 453 | + DESTINATION = location.getLat() + "," + location.getLng(); | ||
| 454 | + descStationName = sr.getName(); | ||
| 455 | + } | ||
| 456 | + | ||
| 457 | + } | ||
| 458 | + | ||
| 459 | + fyString = BusCongestionChecker.DL_YDQK(ORIGIN,DESTINATION,"上海",xlName) + " " +orStationName + "开往" + descStationName + "方向"; | ||
| 460 | + fyString += "\n"; | ||
| 461 | + fyString += BusCongestionChecker.DL_YDQK(DESTINATION,ORIGIN,"上海",xlName) + " " +descStationName + "开往" + orStationName + "方向";; | ||
| 462 | + | ||
| 463 | + } | ||
| 464 | + | ||
| 465 | + return fyString; | ||
| 466 | + } | ||
| 467 | + //线路准点 | ||
| 468 | + public List line_zd(String message){ | ||
| 469 | + | ||
| 470 | + return getScheduleStatistic_lg(DateUtils.qyt_date()); | ||
| 471 | + } | ||
| 472 | + | ||
| 473 | + | ||
| 474 | + public List getScheduleStatistic_lg(String date){ | ||
| 475 | + Map<String, Object> resMap = new HashMap<String, Object>(); | ||
| 476 | + | ||
| 477 | + String gpLineSql = "select * from bsth_c_line_plate"; | ||
| 478 | + List<Map<String, Object>> gpLineList=jdbcTemplate.query(gpLineSql, | ||
| 479 | + new RowMapper<Map<String, Object>>(){ | ||
| 480 | + @Override | ||
| 481 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 482 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 483 | + m.put("lineName", rs.getString("line_name")); | ||
| 484 | + m.put("lineCode", rs.getString("line_code")); | ||
| 485 | + return m; | ||
| 486 | + } | ||
| 487 | + }); | ||
| 488 | + | ||
| 489 | + Set<String> gpSet = new HashSet<String>(); | ||
| 490 | + for(Map<String, Object> t : gpLineList){ | ||
| 491 | + if(t.get("lineCode") != null && t.get("lineCode").toString().trim().length() > 0){ | ||
| 492 | + gpSet.add(t.get("lineCode").toString().trim()); | ||
| 493 | + } | ||
| 494 | + } | ||
| 495 | + | ||
| 496 | + String yyxlSql="SELECT line_code from bsth_c_line " | ||
| 497 | + + " where nature in ('yxl','cgxl','gjxl','csbs','cctxl')"; | ||
| 498 | + List<Map<String, Object>> yyxlList=jdbcTemplate.query(yyxlSql, | ||
| 499 | + new RowMapper<Map<String, Object>>(){ | ||
| 500 | + @Override | ||
| 501 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 502 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 503 | + m.put("lineCode", rs.getString("line_code")); | ||
| 504 | + return m; | ||
| 505 | + } | ||
| 506 | + }); | ||
| 507 | + Set<String> yyLine = new HashSet<String>(); | ||
| 508 | + for(Map<String, Object> t : yyxlList){ | ||
| 509 | + if(t.get("lineCode") != null){ | ||
| 510 | + yyLine.add(t.get("lineCode").toString()); | ||
| 511 | + } | ||
| 512 | + } | ||
| 513 | + | ||
| 514 | + String sql="select xl,xl_name,date,jhbc,bczxl,jhbcz,sjbc,jhcc,sjcc,ccl," | ||
| 515 | + + " jhyylc,sjyylc,jhyylcz,jhkslc,sjkslc,jhkslcz," | ||
| 516 | + + " jhssgfbcs,sjgfbcs,jhgfbcsz,jhssdgbcs,sjdgbcs,jhdgbcsz," | ||
| 517 | + + " jhsmbcs,sjsmbczds,smbczdl,jhsmbcsz,sjsmbczdsz,smbczdlz," | ||
| 518 | + + " jhszfcs,sjszfczds,szfczdl,create_date" | ||
| 519 | + + " from bsth_c_calc_count " | ||
| 520 | + + " where date = ? "; | ||
| 521 | + | ||
| 522 | + List<Map<String, Object>> list=jdbcTemplate.query(sql, new Object[]{date}, | ||
| 523 | + new RowMapper<Map<String, Object>>(){ | ||
| 524 | + @Override | ||
| 525 | + public Map<String, Object> mapRow(ResultSet rs, int rowNum) throws SQLException { | ||
| 526 | + Map<String, Object> m=new HashMap<String,Object>(); | ||
| 527 | + m.put("lineCode",rs.getString("xl")); | ||
| 528 | + m.put("lineName", rs.getString("xl_name")); | ||
| 529 | + m.put("date", rs.getString("date")); | ||
| 530 | + | ||
| 531 | + m.put("jhbc", rs.getString("jhbc")); | ||
| 532 | + m.put("sjbc", rs.getString("sjbc")); | ||
| 533 | + m.put("bczxl", rs.getString("bczxl")); | ||
| 534 | + m.put("jhbcz", rs.getString("jhbcz")); | ||
| 535 | + | ||
| 536 | + m.put("jhcc", rs.getString("jhcc")); | ||
| 537 | + m.put("sjcc", rs.getString("sjcc")); | ||
| 538 | + m.put("ccl", rs.getString("ccl")); | ||
| 539 | + | ||
| 540 | + m.put("jhyylc", rs.getString("jhyylc")); | ||
| 541 | + m.put("sjyylc", rs.getString("sjyylc")); | ||
| 542 | + m.put("jhyylcz", rs.getString("jhyylcz")); | ||
| 543 | + m.put("jhkslc", rs.getString("jhkslc")); | ||
| 544 | + m.put("sjkslc", rs.getString("sjkslc")); | ||
| 545 | + m.put("jhkslcz", rs.getString("jhkslcz")); | ||
| 546 | + | ||
| 547 | + m.put("jhgfbcs", rs.getString("jhssgfbcs")); | ||
| 548 | + m.put("sjgfbcs", rs.getString("sjgfbcs")); | ||
| 549 | + m.put("jhgfbcsz", rs.getString("jhgfbcsz")); | ||
| 550 | + m.put("jhdgbcs", rs.getString("jhssdgbcs")); | ||
| 551 | + m.put("sjdgbcs", rs.getString("sjdgbcs")); | ||
| 552 | + m.put("jhdgbcsz", rs.getString("jhdgbcsz")); | ||
| 553 | + | ||
| 554 | + m.put("jhsmbcs", rs.getString("jhsmbcs")); | ||
| 555 | + m.put("sjsmbczds", rs.getString("sjsmbczds")); | ||
| 556 | + m.put("smbczdl", rs.getString("smbczdl")); | ||
| 557 | + m.put("jhsmbcsz", rs.getString("jhsmbcsz")); | ||
| 558 | + m.put("sjsmbczdsz", rs.getString("sjsmbczdsz")); | ||
| 559 | + m.put("smbczdlz", rs.getString("smbczdlz")); | ||
| 560 | + | ||
| 561 | + m.put("jhszfcs", rs.getString("jhszfcs")); | ||
| 562 | + m.put("sjszfczds", rs.getString("sjszfczds")); | ||
| 563 | + m.put("szfczdl", rs.getString("szfczdl")); | ||
| 564 | + | ||
| 565 | + Date date = new Date(); | ||
| 566 | + date.setTime(rs.getTimestamp("create_date").getTime()); | ||
| 567 | + m.put("createDate", sdf.format(date)); | ||
| 568 | + return m; | ||
| 569 | + } | ||
| 570 | + }); | ||
| 571 | + | ||
| 572 | + List<Map<String, Object>> bcDetail = new ArrayList<Map<String,Object>>(); | ||
| 573 | + List<Map<String, Object>> smDetail = new ArrayList<Map<String,Object>>(); | ||
| 574 | + List<Map<String, Object>> qqDetail = new ArrayList<Map<String,Object>>(); | ||
| 575 | + | ||
| 576 | + | ||
| 577 | + BigDecimal yygl_z = new BigDecimal(0);//实时总营运里程 | ||
| 578 | + | ||
| 579 | + for(Map<String, Object> t : list){ | ||
| 580 | + if(yyLine.contains(t.get("lineCode").toString())){ | ||
| 581 | + yygl_z = yygl_z.add(new BigDecimal(t.get("sjyylc").toString())); | ||
| 582 | + | ||
| 583 | + | ||
| 584 | + Map<String, Object> bc = new HashMap<String, Object>(); | ||
| 585 | + bc.put("type", "班次执行详情"); | ||
| 586 | + bc.put("lineName", t.get("lineName").toString()); | ||
| 587 | + //bc.put("jh", t.get("jhbc").toString()); | ||
| 588 | + //bc.put("sj", t.get("sjbc").toString()); | ||
| 589 | + Double bfbbc = Double.valueOf(t.get("sjbc").toString()) / Double.valueOf(t.get("jhbc").toString()); | ||
| 590 | + bc.put("bfb", String.format("%.2f", bfbbc * 100)); | ||
| 591 | + bc.put("date",date); | ||
| 592 | + bcDetail.add(bc); | ||
| 593 | + | ||
| 594 | + Map<String, Object> sm = new HashMap<String, Object>(); | ||
| 595 | + sm.put("type", "首末班准点详情"); | ||
| 596 | + sm.put("lineName", t.get("lineName").toString()); | ||
| 597 | + // sm.put("jh", t.get("jhsmbcs").toString()); | ||
| 598 | + // sm.put("sj", t.get("sjsmbczds").toString()); | ||
| 599 | + Double bfbsm = Double.valueOf(t.get("sjsmbczds").toString()) / Double.valueOf(t.get("jhsmbcs").toString()); | ||
| 600 | + sm.put("bfb", String.format("%.2f", bfbsm * 100)); | ||
| 601 | + sm.put("date",date); | ||
| 602 | + smDetail.add(sm); | ||
| 603 | + | ||
| 604 | + Map<String, Object> qq = new HashMap<String, Object>(); | ||
| 605 | + qq.put("type", "班次准点详情"); | ||
| 606 | + qq.put("lineName", t.get("lineName").toString()); | ||
| 607 | + //qq.put("jh", t.get("jhszfcs").toString()); | ||
| 608 | + //qq.put("sj", t.get("sjszfczds").toString()); | ||
| 609 | + Double bfbqq = Double.valueOf(t.get("sjszfczds").toString()) / Double.valueOf(t.get("jhszfcs").toString()); | ||
| 610 | + | ||
| 611 | + qq.put("bfb", String.format("%.2f", bfbqq * 100)); | ||
| 612 | + qq.put("date",date); | ||
| 613 | + qqDetail.add(qq); | ||
| 614 | + } | ||
| 615 | + } | ||
| 616 | + | ||
| 617 | + | ||
| 618 | + | ||
| 619 | + List<Map<String, Object>> detailsList = new ArrayList<Map<String, Object>>(); | ||
| 620 | + | ||
| 621 | + detailsList.addAll(bcDetail); | ||
| 622 | + /* detailsList.addAll(smDetail); | ||
| 623 | + detailsList.addAll(qqDetail);*/ | ||
| 624 | + | ||
| 625 | + return detailsList; | ||
| 626 | + } | ||
| 627 | + | ||
| 414 | } | 628 | } |
src/main/java/com/bsth/websocket/handler/SendUtils.java
| @@ -295,5 +295,23 @@ public class SendUtils{ | @@ -295,5 +295,23 @@ public class SendUtils{ | ||
| 295 | logger.error("sendContingencyPlan", e); | 295 | logger.error("sendContingencyPlan", e); |
| 296 | } | 296 | } |
| 297 | } | 297 | } |
| 298 | + | ||
| 299 | + | ||
| 300 | + /** | ||
| 301 | + * 将添加的班次推送到线调页面 | ||
| 302 | + */ | ||
| 303 | + public void refreshaddSch(Map<String, Object> m,String lineCode) { | ||
| 304 | + Map<String, Object> map = new HashMap<>(); | ||
| 305 | + map.put("fn", "readdSch"); | ||
| 306 | + map.put("data", m); | ||
| 307 | + ObjectMapper mapper = new ObjectMapper(); | ||
| 308 | + | ||
| 309 | + try { | ||
| 310 | + socketHandler.sendMessageToLine(lineCode, mapper.writeValueAsString(map)); | ||
| 311 | + } catch (JsonProcessingException e) { | ||
| 312 | + logger.error("sendContingencyPlan", e); | ||
| 313 | + } | ||
| 314 | + } | ||
| 315 | + | ||
| 298 | 316 | ||
| 299 | } | 317 | } |
src/main/resources/application-prod.properties
| @@ -44,5 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP | @@ -44,5 +44,5 @@ baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP | ||
| 44 | passengerFlow.url = http://192.168.168.32:9999/images/ | 44 | passengerFlow.url = http://192.168.168.32:9999/images/ |
| 45 | 45 | ||
| 46 | electricity.importFile.path= /home/control/elecImportFile | 46 | electricity.importFile.path= /home/control/elecImportFile |
| 47 | - | 47 | +baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK |
| 48 | report_register.complaint.url= http://10.10.200.113:8060/complaint/TsReport/input.do | 48 | report_register.complaint.url= http://10.10.200.113:8060/complaint/TsReport/input.do |
src/main/resources/application-test.properties
| @@ -42,7 +42,7 @@ dc.profile= profile | @@ -42,7 +42,7 @@ dc.profile= profile | ||
| 42 | 42 | ||
| 43 | baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP | 43 | baidu.ak=AYiBOs3f9qBQFhdKFsaboX6CfObmKwRP |
| 44 | passengerFlow.url = http://127.0.0.1:9999/images/ | 44 | passengerFlow.url = http://127.0.0.1:9999/images/ |
| 45 | - | 45 | +baidu.akyd=WnSDHZgtPbSbw2LfsH3KO3DDKWONmlYK |
| 46 | electricity.importFile.path= E:/elecImportFile | 46 | electricity.importFile.path= E:/elecImportFile |
| 47 | 47 | ||
| 48 | report_register.complaint.url= http://192.168.168.172:8080/complaint/TsReport/input.do | 48 | report_register.complaint.url= http://192.168.168.172:8080/complaint/TsReport/input.do |
src/main/resources/static/pages/forms/zndd/logger_dkl.html
| @@ -27,21 +27,23 @@ | @@ -27,21 +27,23 @@ | ||
| 27 | <div class="portlet light porttlet-fit bordered"> | 27 | <div class="portlet light porttlet-fit bordered"> |
| 28 | <div class="portlet-title"> | 28 | <div class="portlet-title"> |
| 29 | <form class="form-inline" action=""> | 29 | <form class="form-inline" action=""> |
| 30 | - <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_daily"> | ||
| 31 | - <span class="item-label" style="width: 80px;">公司: </span> | ||
| 32 | - <select class="form-control" name="company" id="gsdmDaily" style="width: 180px;"></select> | ||
| 33 | - </div> | ||
| 34 | - <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_daily"> | ||
| 35 | - <span class="item-label" style="width: 80px;">分公司: </span> | ||
| 36 | - <select class="form-control" name="subCompany" id="fgsdmDaily" style="width: 180px;"></select> | ||
| 37 | - </div> | ||
| 38 | - <div style="margin-top: 2px"></div> | 30 | + |
| 39 | <div style="display: inline-block;margin-left: 33px;"> | 31 | <div style="display: inline-block;margin-left: 33px;"> |
| 40 | <span class="item-label" style="width: 80px;">线路: </span> | 32 | <span class="item-label" style="width: 80px;">线路: </span> |
| 41 | <select class="form-control" name="line" id="line" style="width: 180px;"> | 33 | <select class="form-control" name="line" id="line" style="width: 180px;"> |
| 42 | <option value="">请选择线路...</option> | 34 | <option value="">请选择线路...</option> |
| 43 | </select> | 35 | </select> |
| 44 | </div> | 36 | </div> |
| 37 | + <div style="display: inline-block;margin-left: 24px;"> | ||
| 38 | + <span class="item-label" style="width: 80px;"> 开始时间: </span> | ||
| 39 | + <input class="form-control" type="text" id="startDate" style="width: 180px;"/> | ||
| 40 | + </div> | ||
| 41 | + | ||
| 42 | + <div style="display: inline-block;margin-left: 24px;"> | ||
| 43 | + <span class="item-label" style="width: 80px;"> 结束时间: </span> | ||
| 44 | + <input class="form-control" type="text" id="endDate" style="width: 180px;"/> | ||
| 45 | + </div> | ||
| 46 | + | ||
| 45 | <!-- <div style="display: inline-block;margin-left: 24px;"> | 47 | <!-- <div style="display: inline-block;margin-left: 24px;"> |
| 46 | <span class="item-label" style="width: 80px;"> 时间: </span> | 48 | <span class="item-label" style="width: 80px;"> 时间: </span> |
| 47 | <input class="form-control" type="text" id="date" style="width: 180px;"/> | 49 | <input class="form-control" type="text" id="date" style="width: 180px;"/> |
| @@ -86,7 +88,12 @@ | @@ -86,7 +88,12 @@ | ||
| 86 | if (!$('body').hasClass('page-sidebar-closed')) | 88 | if (!$('body').hasClass('page-sidebar-closed')) |
| 87 | $('.menu-toggler.sidebar-toggler').click(); | 89 | $('.menu-toggler.sidebar-toggler').click(); |
| 88 | 90 | ||
| 89 | - $("#date").datetimepicker({ | 91 | + $("#startDate").datetimepicker({ |
| 92 | + format : 'YYYY-MM-DD', | ||
| 93 | + locale : 'zh-cn' | ||
| 94 | + }); | ||
| 95 | + | ||
| 96 | + $("#endDate").datetimepicker({ | ||
| 90 | format : 'YYYY-MM-DD', | 97 | format : 'YYYY-MM-DD', |
| 91 | locale : 'zh-cn' | 98 | locale : 'zh-cn' |
| 92 | }); | 99 | }); |
| @@ -168,24 +175,30 @@ | @@ -168,24 +175,30 @@ | ||
| 168 | 175 | ||
| 169 | 176 | ||
| 170 | var line; | 177 | var line; |
| 171 | - var date; | 178 | + var startDate; |
| 179 | + var endDate; | ||
| 172 | var gsdmDaily; | 180 | var gsdmDaily; |
| 173 | var fgsdmDaily; | 181 | var fgsdmDaily; |
| 174 | var lineName=$("#select2-line-container").html(); | 182 | var lineName=$("#select2-line-container").html(); |
| 175 | $("#query").on("click",function(){ | 183 | $("#query").on("click",function(){ |
| 176 | - /* if($("#date").val() == null || $("#date").val().trim().length == 0){ | ||
| 177 | - layer.msg("请选择时间"); | ||
| 178 | - return; | ||
| 179 | - }*/ | 184 | + |
| 180 | line = $("#line").val(); | 185 | line = $("#line").val(); |
| 181 | - date = $("#date").val(); | 186 | + startDate = $("#startDate").val(); |
| 187 | + endDate = $("#endDate").val(); | ||
| 188 | + | ||
| 182 | gsdmDaily=$("#gsdmDaily").val(); | 189 | gsdmDaily=$("#gsdmDaily").val(); |
| 183 | fgsdmDaily = $("#fgsdmDaily").val(); | 190 | fgsdmDaily = $("#fgsdmDaily").val(); |
| 184 | lineName=$("#select2-line-container").html(); | 191 | lineName=$("#select2-line-container").html(); |
| 192 | + | ||
| 193 | + var fs = 'YYYY-MM-DD HH:mm'; | ||
| 194 | + var st = parseInt(moment(startDate, fs).format('X')); | ||
| 195 | + var et = parseInt(moment(endDate, fs).format('X')); | ||
| 196 | + | ||
| 197 | + if(et < st) | ||
| 198 | + notify_err('结束时间不能小于开始时间!'); | ||
| 199 | + | ||
| 185 | var i = layer.load(2); | 200 | var i = layer.load(2); |
| 186 | - $get('/dkl_logger/all',{lineCode_eq:line,type:'query'},function(result){ | ||
| 187 | - $("#form_line").text(lineName); | ||
| 188 | - $("#form_date").text(date); | 201 | + $get('/dkl_logger/all',{lineCode_eq:line,type:'query',createDate_ge:startDate,createDate_le:endDate,Order_desc:"create_date"},function(result){ |
| 189 | 202 | ||
| 190 | $.each(result, function(i, obj) { | 203 | $.each(result, function(i, obj) { |
| 191 | obj.createDate = moment(obj.createDate).format("YYYY-MM-DD HH:mm:ss"); | 204 | obj.createDate = moment(obj.createDate).format("YYYY-MM-DD HH:mm:ss"); |
src/main/resources/static/real_control_v2/js/stationcf/klyj.js
| @@ -78,12 +78,12 @@ var gb_klyj = (function () { | @@ -78,12 +78,12 @@ var gb_klyj = (function () { | ||
| 78 | 78 | ||
| 79 | function TSDkl(){ | 79 | function TSDkl(){ |
| 80 | var $modal = $('#schedule-addsch-modal'); | 80 | var $modal = $('#schedule-addsch-modal'); |
| 81 | - if (!$modal.hasClass('uk-open')) { | 81 | + /* if (!$modal.hasClass('uk-open')) { |
| 82 | if (!gb_dataZndd.interval){ | 82 | if (!gb_dataZndd.interval){ |
| 83 | gb_dataZndd.interval = gb_dataZndd.snt(data.ids); | 83 | gb_dataZndd.interval = gb_dataZndd.snt(data.ids); |
| 84 | } | 84 | } |
| 85 | gb_dataZndd.setTimelist(data.uuid) //自动调度定时器 | 85 | gb_dataZndd.setTimelist(data.uuid) //自动调度定时器 |
| 86 | - } | 86 | + }*/ |
| 87 | $wrap.append(htmlStr); | 87 | $wrap.append(htmlStr); |
| 88 | } | 88 | } |
| 89 | }; | 89 | }; |
src/main/resources/static/real_control_v2/js/websocket/sch_websocket.js
| @@ -220,6 +220,17 @@ var gb_sch_websocket = (function () { | @@ -220,6 +220,17 @@ var gb_sch_websocket = (function () { | ||
| 220 | var klyj = function (msg){ | 220 | var klyj = function (msg){ |
| 221 | gb_klyj.popcf(msg.data); | 221 | gb_klyj.popcf(msg.data); |
| 222 | }; | 222 | }; |
| 223 | + //刷新添加班次状态 | ||
| 224 | + var klyj = function (msg){ | ||
| 225 | + gb_klyj.popcf(msg.data); | ||
| 226 | + }; | ||
| 227 | + | ||
| 228 | + var readdSch = function (msg){ | ||
| 229 | + var rs = msg.data; | ||
| 230 | + debugger | ||
| 231 | + gb_schedule_table.insertSchedule(rs.t, rs.ts); | ||
| 232 | + } | ||
| 233 | + | ||
| 223 | 234 | ||
| 224 | var msgHandle = { | 235 | var msgHandle = { |
| 225 | report80: report80, | 236 | report80: report80, |
| @@ -236,7 +247,8 @@ var gb_sch_websocket = (function () { | @@ -236,7 +247,8 @@ var gb_sch_websocket = (function () { | ||
| 236 | contingencyPlan: contingencyPlan, | 247 | contingencyPlan: contingencyPlan, |
| 237 | stationcf: stationcf, | 248 | stationcf: stationcf, |
| 238 | zndd : zndd, | 249 | zndd : zndd, |
| 239 | - klyj:klyj | 250 | + klyj:klyj, |
| 251 | + readdSch:readdSch, | ||
| 240 | }; | 252 | }; |
| 241 | 253 | ||
| 242 | function currentSecond() { | 254 | function currentSecond() { |
src/main/resources/static/real_control_v2/js/zndd/recorder/recorder.js
| @@ -233,7 +233,30 @@ | @@ -233,7 +233,30 @@ | ||
| 233 | }); | 233 | }); |
| 234 | return; | 234 | return; |
| 235 | } | 235 | } |
| 236 | - else if(responseText[1]=="3"){//新增班次 | 236 | + else if(responseText[1]=="3"){//新增进场班次 |
| 237 | + if(schId==''){ | ||
| 238 | + var sch ={ | ||
| 239 | + xlBm : lineCode | ||
| 240 | + } | ||
| 241 | + var fun =gb_schedule_context_menu.add_temp_sch_v2; | ||
| 242 | + fun(sch, function () { | ||
| 243 | + confirmBtn.trigger('click'); | ||
| 244 | + }); | ||
| 245 | + return; | ||
| 246 | + } | ||
| 247 | + var sch = gb_schedule_table.findScheduleByLine(lineCode)[schId]; | ||
| 248 | + sch = Object.assign({}, sch); | ||
| 249 | + var confirmBtn = $(this).parent().find('.uk-button-primary'); | ||
| 250 | + var fun =gb_schedule_context_menu.add_temp_sch; | ||
| 251 | + sch.bcType='in'; | ||
| 252 | + sch.qdzCode=getCarPark(sch)[0].code; | ||
| 253 | + sch.qdzName=getCarPark(sch)[0].name; | ||
| 254 | + fun(sch, function () { | ||
| 255 | + confirmBtn.trigger('click'); | ||
| 256 | + }); | ||
| 257 | + return; | ||
| 258 | + } | ||
| 259 | + else if(responseText[1]=="4"){//新增班次 | ||
| 237 | if(schId==''){ | 260 | if(schId==''){ |
| 238 | var sch ={ | 261 | var sch ={ |
| 239 | xlBm : lineCode | 262 | xlBm : lineCode |
src/main/resources/static/real_control_v2/main.html
| @@ -445,18 +445,51 @@ | @@ -445,18 +445,51 @@ | ||
| 445 | 445 | ||
| 446 | </script> | 446 | </script> |
| 447 | 447 | ||
| 448 | +<!-- 消息提示框 // 大客流添加班次后续观察框 | ||
| 449 | +<div class="multi_plat_zndd_message" id="messageBox"> | ||
| 450 | + | ||
| 451 | +</div> | ||
| 452 | + | ||
| 453 | +<script id="zndd_message" type="text/html"> | ||
| 454 | + <div class="message-summary"> | ||
| 455 | + 大客流行驶班次{{dklNum}}条 | ||
| 456 | + </div> | ||
| 457 | + <div class="message-details" id="messageDetails"> | ||
| 458 | + <h3>消息详情</h3> | ||
| 459 | + <div class="message_add1"> | ||
| 460 | + <!– | ||
| 461 | + <div><strong>严重 (3条):</strong></div> | ||
| 462 | + <div>严重消息1</div> | ||
| 463 | + <div>严重消息2</div> | ||
| 464 | + <div>严重消息3</div> | ||
| 465 | + –> | ||
| 466 | + </div> | ||
| 467 | + | ||
| 468 | + <!– <div><strong>轻微 (3条):</strong></div> | ||
| 469 | + <div>轻微消息1</div> | ||
| 470 | + <div>轻微消息2</div> | ||
| 471 | + <div>轻微消息3</div> | ||
| 472 | + <div><strong>可忽略 (5条):</strong></div> | ||
| 473 | + <div>可忽略消息1</div> | ||
| 474 | + <div>可忽略消息2</div> | ||
| 475 | + <div>可忽略消息3</div> | ||
| 476 | + <div>可忽略消息4</div> | ||
| 477 | + <div>可忽略消息5</div>–> | ||
| 478 | + </div> | ||
| 479 | +</script> | ||
| 480 | +<script src="/real_control_v2/js/zndd/zndd_message.js"></script>--> | ||
| 448 | 481 | ||
| 449 | <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> | 482 | <script src="/real_control_v2/js/safe_driv/safeDriv.js" merge="custom_js"></script> |
| 450 | <script src="/real_control_v2/js/con_plan/conPlan.js" merge="custom_js"></script> | 483 | <script src="/real_control_v2/js/con_plan/conPlan.js" merge="custom_js"></script> |
| 451 | <!--站点催发--> | 484 | <!--站点催发--> |
| 452 | -<script src="/real_control_v2/js/stationcf/stationcf.js" merge="custom_js"></script> | 485 | +<script src="/real_control_v2/js/stationcf/stationcf.js"></script> |
| 453 | <!--智能调度--> | 486 | <!--智能调度--> |
| 454 | -<script src="/real_control_v2/js/zndd/data_zndd.js" merge="custom_js"></script> | ||
| 455 | -<script src="/real_control_v2/js/zndd/dkl_yanshi.js" merge="custom_js"></script> | 487 | +<script src="/real_control_v2/js/zndd/data_zndd.js"></script> |
| 488 | +<script src="/real_control_v2/js/zndd/dkl_yanshi.js"></script> | ||
| 456 | 489 | ||
| 457 | 490 | ||
| 458 | <!--站点催发--> | 491 | <!--站点催发--> |
| 459 | -<script src="/real_control_v2/js/stationcf/klyj.js" merge="custom_js"></script> | 492 | +<script src="/real_control_v2/js/stationcf/klyj.js"></script> |
| 460 | <!--语音图标--> | 493 | <!--语音图标--> |
| 461 | <script src="/real_control_v2/js/zndd//recorder/microphone.js"></script> | 494 | <script src="/real_control_v2/js/zndd//recorder/microphone.js"></script> |
| 462 | 495 |