Commit cc9a5fd5c68d83e145f74489be2021a6be626ee6
1 parent
3b0f5480
update...
Showing
23 changed files
with
349 additions
and
148 deletions
src/main/java/com/bsth/Test.java deleted
100644 → 0
| 1 | -//package com.bsth; | |
| 2 | -// | |
| 3 | -//import java.io.ByteArrayOutputStream; | |
| 4 | -//import java.io.IOException; | |
| 5 | -//import java.io.InputStream; | |
| 6 | -//import java.io.OutputStream; | |
| 7 | -//import java.net.HttpURLConnection; | |
| 8 | -//import java.net.URL; | |
| 9 | -//import java.util.HashMap; | |
| 10 | -//import java.util.Map; | |
| 11 | -// | |
| 12 | -//import org.apache.commons.io.IOUtils; | |
| 13 | -// | |
| 14 | -//import com.fasterxml.jackson.databind.ObjectMapper; | |
| 15 | -// | |
| 16 | -//public class Test { | |
| 17 | -// | |
| 18 | -// public static void main(String[] args) { | |
| 19 | -// Map<String, Object> map = new HashMap<>(); | |
| 20 | -// map.put("timestamp", 1469764939000L); | |
| 21 | -// map.put("operCode", 128); | |
| 22 | -// map.put("deviceId", "66ML0007"); | |
| 23 | -// | |
| 24 | -// Map<String , Object> dataMap = new HashMap<>(); | |
| 25 | -// dataMap.put("requestCode", 161); | |
| 26 | -// dataMap.put("lineId", 1025); | |
| 27 | -// dataMap.put("operCode2", 38); | |
| 28 | -// | |
| 29 | -// map.put("data", dataMap); | |
| 30 | -// request(map, "http://192.168.168.171:9088/control/upstream"); | |
| 31 | -// | |
| 32 | -// } | |
| 33 | -// | |
| 34 | -// private static Map<String, Object> request(Map<String, Object> map, String url) { | |
| 35 | -// InputStream in = null; | |
| 36 | -// OutputStream out = null; | |
| 37 | -// HttpURLConnection con = null; | |
| 38 | -// try { | |
| 39 | -// con = (HttpURLConnection)new URL(url).openConnection(); | |
| 40 | -// con.setRequestMethod("POST"); | |
| 41 | -// con.setRequestProperty("keep-alive", "true"); | |
| 42 | -// con.setRequestProperty("accept", "*/*"); | |
| 43 | -// con.setDoInput(true); | |
| 44 | -// con.setDoOutput(true); | |
| 45 | -// con.setReadTimeout(2500); | |
| 46 | -// con.setConnectTimeout(2500); | |
| 47 | -// out = con.getOutputStream(); | |
| 48 | -// out.write("json=".getBytes()); | |
| 49 | -// out.write(new ObjectMapper().writeValueAsBytes(map)); | |
| 50 | -// out.flush(); | |
| 51 | -// System.out.println("con.getResponseCode(): " + con.getResponseCode()); | |
| 52 | -// if (con.getResponseCode() == 200) { | |
| 53 | -// in = con.getInputStream(); | |
| 54 | -// ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 55 | -// IOUtils.copy(in, bout); bout.close(); | |
| 56 | -// System.out.println("Message:" + new String(bout.toByteArray())); | |
| 57 | -// return new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 58 | -// } | |
| 59 | -// } catch (IOException e) { | |
| 60 | -// e.printStackTrace(); | |
| 61 | -// } finally { | |
| 62 | -// con.disconnect(); | |
| 63 | -// try { | |
| 64 | -// if (in != null) in.close(); | |
| 65 | -// if (out != null) out.close(); | |
| 66 | -// } catch (IOException e) { | |
| 67 | -// e.printStackTrace(); | |
| 68 | -// } | |
| 69 | -// } | |
| 70 | -// return null; | |
| 71 | -// } | |
| 72 | -//} |
src/main/java/com/bsth/Test2.java deleted
100644 → 0
| 1 | -package com.bsth; | |
| 2 | - | |
| 3 | -public class Test2 { | |
| 4 | - | |
| 5 | - public static void main(String[] args) { | |
| 6 | - | |
| 7 | - for(int i = 0; i < 20; i ++){ | |
| 8 | - new MyThread(i + "").start(); | |
| 9 | - } | |
| 10 | - } | |
| 11 | - | |
| 12 | - public static class MyThread extends Thread { | |
| 13 | - | |
| 14 | - private String name ; | |
| 15 | - | |
| 16 | - public MyThread(String name) { | |
| 17 | - this.name = name; | |
| 18 | - } | |
| 19 | - | |
| 20 | - @Override | |
| 21 | - public void run() { | |
| 22 | - method(name); | |
| 23 | - } | |
| 24 | - } | |
| 25 | - | |
| 26 | - public static void method(String name){ | |
| 27 | - System.out.println("线程" + name + "开始..."); | |
| 28 | - int a = 0; | |
| 29 | - for(int i = 0; i < 1000; i ++){ | |
| 30 | - a ++; | |
| 31 | - } | |
| 32 | - a--; | |
| 33 | - System.out.println("线程" + name + "结束... a = " + a); | |
| 34 | - } | |
| 35 | -} |
src/main/java/com/bsth/controller/StationRouteController.java
| ... | ... | @@ -120,6 +120,15 @@ public class StationRouteController extends BaseController<StationRoute, Integer |
| 120 | 120 | return stationRouteRepository.findStations(xlid, xldir); |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - | |
| 123 | + /** | |
| 124 | + * | |
| 125 | + * @Title: findByMultiLine | |
| 126 | + * @Description: TODO(多线路路由查询) | |
| 127 | + */ | |
| 128 | + @RequestMapping(value = "/multiLine", method = RequestMethod.GET) | |
| 129 | + public Map<String, Object> findByMultiLine(@RequestParam String lineIds){ | |
| 130 | + | |
| 131 | + return service.findByMultiLine(lineIds); | |
| 132 | + } | |
| 124 | 133 | |
| 125 | 134 | } | ... | ... |
src/main/java/com/bsth/controller/gps/GpsController.java
| ... | ... | @@ -24,6 +24,17 @@ public class GpsController { |
| 24 | 24 | |
| 25 | 25 | @Autowired |
| 26 | 26 | GpsService gpsService; |
| 27 | + | |
| 28 | + @RequestMapping(value = "/real/all") | |
| 29 | + public Map<String, Object> search(@RequestParam Map<String, Object> map, | |
| 30 | + @RequestParam(defaultValue = "0") int page, | |
| 31 | + @RequestParam(defaultValue = "15") int size, | |
| 32 | + @RequestParam(defaultValue = "timestamp") String order, | |
| 33 | + @RequestParam(defaultValue = "DESC") String direction){ | |
| 34 | + | |
| 35 | + | |
| 36 | + return gpsService.search(map, page, size, order, direction); | |
| 37 | + } | |
| 27 | 38 | |
| 28 | 39 | @RequestMapping(value = "/real/line/{lineCode}") |
| 29 | 40 | public List<GpsEntity> findByLineCode(@PathVariable("lineCode") String lineCode) { | ... | ... |
src/main/java/com/bsth/controller/realcontrol/BasicDataController.java
0 → 100644
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import java.util.Map; | |
| 4 | + | |
| 5 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 6 | +import org.springframework.web.bind.annotation.RestController; | |
| 7 | + | |
| 8 | +import com.bsth.data.BasicData; | |
| 9 | + | |
| 10 | +@RestController | |
| 11 | +@RequestMapping("/basic") | |
| 12 | +public class BasicDataController { | |
| 13 | + | |
| 14 | + | |
| 15 | + @RequestMapping("/cars") | |
| 16 | + public Iterable<String> findAllNbbm(Map<String, Object> map){ | |
| 17 | + return BasicData.deviceId2NbbmMap.values(); | |
| 18 | + } | |
| 19 | + | |
| 20 | + @RequestMapping("/lineCode2Name") | |
| 21 | + public Map<String, String> findLineCodeMap(){ | |
| 22 | + return BasicData.lineCode2NameMap; | |
| 23 | + } | |
| 24 | +} | ... | ... |
src/main/java/com/bsth/data/directive/DayOfDirectives.java
src/main/java/com/bsth/data/gpsdata/GpsEntity.java
| ... | ... | @@ -63,6 +63,9 @@ public class GpsEntity { |
| 63 | 63 | |
| 64 | 64 | /** 当前执行班次ID */ |
| 65 | 65 | private Long schId; |
| 66 | + | |
| 67 | + /** 是否异常数据 */ | |
| 68 | + private boolean abnormal; | |
| 66 | 69 | |
| 67 | 70 | public Integer getCompanyCode() { |
| 68 | 71 | return companyCode; |
| ... | ... | @@ -207,4 +210,12 @@ public class GpsEntity { |
| 207 | 210 | public void setSchId(Long schId) { |
| 208 | 211 | this.schId = schId; |
| 209 | 212 | } |
| 213 | + | |
| 214 | + public boolean isAbnormal() { | |
| 215 | + return abnormal; | |
| 216 | + } | |
| 217 | + | |
| 218 | + public void setAbnormal(boolean abnormal) { | |
| 219 | + this.abnormal = abnormal; | |
| 220 | + } | |
| 210 | 221 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.data.gpsdata; |
| 3 | 3 | import java.io.BufferedReader; |
| 4 | 4 | import java.io.InputStreamReader; |
| 5 | 5 | import java.util.ArrayList; |
| 6 | +import java.util.Collection; | |
| 6 | 7 | import java.util.HashMap; |
| 7 | 8 | import java.util.List; |
| 8 | 9 | import java.util.Map; |
| ... | ... | @@ -115,6 +116,10 @@ public class GpsRealData implements CommandLineRunner{ |
| 115 | 116 | ScheduleRealInfo sch; |
| 116 | 117 | for(String device : set){ |
| 117 | 118 | gps = gpsMap.get(device); |
| 119 | + //过滤异常GPS数据 | |
| 120 | + if(gps.isAbnormal()) | |
| 121 | + continue; | |
| 122 | + | |
| 118 | 123 | sch = dayOfSchedule.execPlamMap().get(gps.getNbbm()); |
| 119 | 124 | if(null != sch) |
| 120 | 125 | gps.setSchId(sch.getId()); |
| ... | ... | @@ -136,6 +141,10 @@ public class GpsRealData implements CommandLineRunner{ |
| 136 | 141 | return gpsMap.get(deviceId); |
| 137 | 142 | } |
| 138 | 143 | |
| 144 | + public Collection<GpsEntity> all(){ | |
| 145 | + return gpsMap.values(); | |
| 146 | + } | |
| 147 | + | |
| 139 | 148 | @Component |
| 140 | 149 | public static class GpsDataLoader extends Thread{ |
| 141 | 150 | |
| ... | ... | @@ -182,9 +191,10 @@ public class GpsRealData implements CommandLineRunner{ |
| 182 | 191 | for(GpsEntity gps : list){ |
| 183 | 192 | nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); |
| 184 | 193 | if(StringUtils.isBlank(nbbm)) |
| 185 | - continue; | |
| 194 | + gps.setAbnormal(true);//标记为异常数据 | |
| 195 | + else | |
| 196 | + gps.setNbbm(nbbm); | |
| 186 | 197 | |
| 187 | - gps.setNbbm(nbbm); | |
| 188 | 198 | gps.setStationName(BasicData.stationCode2NameMap.get(gps.getStopNo())); |
| 189 | 199 | gpsRealData.add(gps); |
| 190 | 200 | } | ... | ... |
src/main/java/com/bsth/data/schedule/thread/ScheduleLateThread.java
| ... | ... | @@ -47,7 +47,9 @@ public class ScheduleLateThread extends Thread{ |
| 47 | 47 | if(sch.getDfsjT() > t) |
| 48 | 48 | break; |
| 49 | 49 | |
| 50 | - if(sch.getStatus() == 0 && sch.getFcsjActual() == null){ | |
| 50 | + if(sch.isLate() == false | |
| 51 | + && sch.getStatus() == 0 | |
| 52 | + && sch.getFcsjActual() == null){ | |
| 51 | 53 | //应发未发 |
| 52 | 54 | sch.setLate(true); |
| 53 | 55 | //通知客户端 | ... | ... |
src/main/java/com/bsth/entity/directive/D64.java
| ... | ... | @@ -40,6 +40,8 @@ public class D64 extends Directive{ |
| 40 | 40 | private String deviceId; |
| 41 | 41 | |
| 42 | 42 | private String lineId; |
| 43 | + | |
| 44 | + private String txtContent; | |
| 43 | 45 | |
| 44 | 46 | public Short getCityCode() { |
| 45 | 47 | return cityCode; |
| ... | ... | @@ -64,6 +66,14 @@ public class D64 extends Directive{ |
| 64 | 66 | public void setLineId(String lineId) { |
| 65 | 67 | this.lineId = lineId; |
| 66 | 68 | } |
| 69 | + | |
| 70 | + public String getTxtContent() { | |
| 71 | + return txtContent; | |
| 72 | + } | |
| 73 | + | |
| 74 | + public void setTxtContent(String txtContent) { | |
| 75 | + this.txtContent = txtContent; | |
| 76 | + } | |
| 67 | 77 | } |
| 68 | 78 | |
| 69 | 79 | public Integer getId() { | ... | ... |
src/main/java/com/bsth/entity/directive/DC0_A4.java
0 → 100644
| 1 | +package com.bsth.entity.directive; | |
| 2 | + | |
| 3 | +import javax.persistence.Embeddable; | |
| 4 | +import javax.persistence.GeneratedValue; | |
| 5 | +import javax.persistence.Id; | |
| 6 | + | |
| 7 | +/** | |
| 8 | + * | |
| 9 | + * @ClassName: DC0_A4 | |
| 10 | + * @Description: TODO(参数查询) | |
| 11 | + * @author PanZhao | |
| 12 | + * @date 2016年10月18日 下午5:22:36 | |
| 13 | + * | |
| 14 | + */ | |
| 15 | +public class DC0_A4 extends Directive{ | |
| 16 | + | |
| 17 | + @Id | |
| 18 | + @GeneratedValue | |
| 19 | + private Integer id; | |
| 20 | + | |
| 21 | + | |
| 22 | + @Embeddable | |
| 23 | + public static class DC0A4Data { | |
| 24 | + /** | |
| 25 | + * 二级协议 | |
| 26 | + */ | |
| 27 | + private Short operCode2; | |
| 28 | + /** 设备编号 */ | |
| 29 | + private String deviceId; | |
| 30 | + /** 网关IP地址 */ | |
| 31 | + private String ipAddress; | |
| 32 | + /** 网关端口 */ | |
| 33 | + private int port; | |
| 34 | + /** 定时定距上报模式 */ | |
| 35 | + private short reportMode; | |
| 36 | + /** 定时上报时间间隔 */ | |
| 37 | + private int interval; | |
| 38 | + /** 定距上报距离间隔 */ | |
| 39 | + private String distance; | |
| 40 | + /** 非线路状态超速阀门 */ | |
| 41 | + private short speedingThreshold; | |
| 42 | + /** 预警阀门 */ | |
| 43 | + private short alarmThreshold; | |
| 44 | + /** pos机IP地址 */ | |
| 45 | + private String posIpAddress; | |
| 46 | + } | |
| 47 | +} | ... | ... |
src/main/java/com/bsth/repository/StationRouteRepository.java
| ... | ... | @@ -250,4 +250,8 @@ public interface StationRouteRepository extends BaseRepository<StationRoute, Int |
| 250 | 250 | |
| 251 | 251 | @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode") |
| 252 | 252 | List<StationRoute> findByLine(String lineCode, int updown); |
| 253 | + | |
| 254 | + @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH) | |
| 255 | + @Query("select s from StationRoute s where s.destroy=0 and s.lineCode=?1") | |
| 256 | + List<StationRoute> findByLineCode(String lineCode); | |
| 253 | 257 | } | ... | ... |
src/main/java/com/bsth/service/StationRouteService.java
| ... | ... | @@ -78,4 +78,6 @@ public interface StationRouteService extends BaseService<StationRoute, Integer> |
| 78 | 78 | * @return List<Map<String, Object>> |
| 79 | 79 | */ |
| 80 | 80 | List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map); |
| 81 | + | |
| 82 | + Map<String, Object> findByMultiLine(String lineIds); | |
| 81 | 83 | } | ... | ... |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| ... | ... | @@ -235,13 +235,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 235 | 235 | int code = GatewayHttpUtils.postJson(JSON.toJSONString(d64)); |
| 236 | 236 | // 入库 |
| 237 | 237 | d64.setHttpCode(code); |
| 238 | + d64.getData().setTxtContent("切换线路[" + lineCode + "]"); | |
| 238 | 239 | dayOfDirectives.put64(d64); |
| 239 | 240 | |
| 240 | 241 | // 通知设备刷新线路文件,忽略结果 |
| 241 | 242 | if (code == 0) |
| 242 | 243 | GatewayHttpUtils.postJson(crt.createDeviceRefreshData(deviceId, lineCode)); |
| 243 | 244 | else |
| 244 | - d64.setErrorText("[刷新线路文件] 网关通讯失败, code: " + code); | |
| 245 | + d64.setErrorText(" 网关通讯失败, code: " + code); | |
| 245 | 246 | |
| 246 | 247 | d64Repository.save(d64); |
| 247 | 248 | return code; |
| ... | ... | @@ -408,7 +409,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen |
| 408 | 409 | } |
| 409 | 410 | |
| 410 | 411 | rsMap.put("list", rs); |
| 411 | - rsMap.put("totalPages", count % size == 0 ? count / size : count / size + 1); | |
| 412 | + rsMap.put("totalPages", count % size == 0 ? (count / size - 1) : count / size); | |
| 412 | 413 | rsMap.put("page", page); |
| 413 | 414 | return rsMap; |
| 414 | 415 | } | ... | ... |
src/main/java/com/bsth/service/forecast/util/CreateByArrivalData.java
src/main/java/com/bsth/service/gps/GpsService.java
| ... | ... | @@ -10,4 +10,6 @@ public interface GpsService { |
| 10 | 10 | List<Map<String, Object>> history(String[] nbbmArray, Long st, Long et); |
| 11 | 11 | |
| 12 | 12 | Map<String, Object> findBuffAeraByCode(String code, String type); |
| 13 | + | |
| 14 | + Map<String, Object> search(Map<String, Object> map, int page, int size, String order, String direction); | |
| 13 | 15 | } | ... | ... |
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
| 1 | 1 | package com.bsth.service.gps; |
| 2 | 2 | |
| 3 | +import java.lang.reflect.Field; | |
| 3 | 4 | import java.sql.Connection; |
| 4 | 5 | import java.sql.PreparedStatement; |
| 5 | 6 | import java.sql.ResultSet; |
| 6 | 7 | import java.util.ArrayList; |
| 7 | 8 | import java.util.Calendar; |
| 9 | +import java.util.Collection; | |
| 8 | 10 | import java.util.Collections; |
| 9 | 11 | import java.util.Comparator; |
| 10 | 12 | import java.util.Date; |
| ... | ... | @@ -17,8 +19,11 @@ import org.slf4j.LoggerFactory; |
| 17 | 19 | import org.springframework.beans.factory.annotation.Autowired; |
| 18 | 20 | import org.springframework.stereotype.Service; |
| 19 | 21 | |
| 22 | +import com.bsth.common.ResponseCode; | |
| 20 | 23 | import com.bsth.data.BasicData; |
| 21 | 24 | import com.bsth.data.arrival.ArrivalEntity; |
| 25 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 26 | +import com.bsth.data.gpsdata.GpsRealData; | |
| 22 | 27 | import com.bsth.repository.CarParkRepository; |
| 23 | 28 | import com.bsth.repository.StationRepository; |
| 24 | 29 | import com.bsth.util.DateUtils; |
| ... | ... | @@ -37,6 +42,9 @@ public class GpsServiceImpl implements GpsService{ |
| 37 | 42 | ResultSet rs = null; |
| 38 | 43 | |
| 39 | 44 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 45 | + | |
| 46 | + @Autowired | |
| 47 | + GpsRealData gpsRealData; | |
| 40 | 48 | |
| 41 | 49 | // 历史gps查询 |
| 42 | 50 | @Override |
| ... | ... | @@ -307,4 +315,89 @@ public class GpsServiceImpl implements GpsService{ |
| 307 | 315 | |
| 308 | 316 | return rs; |
| 309 | 317 | } |
| 318 | + | |
| 319 | + @Override | |
| 320 | + public Map<String, Object> search(Map<String, Object> map, int page, int size, String order, String direction) { | |
| 321 | + Map<String, Object> rsMap = new HashMap<>(); | |
| 322 | + try{ | |
| 323 | + //全量 | |
| 324 | + Collection<GpsEntity> list = gpsRealData.all(); | |
| 325 | + //过滤后的 | |
| 326 | + List<GpsEntity> rs = new ArrayList<>(); | |
| 327 | + Field[] fields = GpsEntity.class.getDeclaredFields(); | |
| 328 | + //排序字段 | |
| 329 | + Field orderField = null; | |
| 330 | + //参与过滤的字段 | |
| 331 | + List<Field> fs = new ArrayList<>(); | |
| 332 | + for(Field f : fields){ | |
| 333 | + f.setAccessible(true); | |
| 334 | + if(map.containsKey(f.getName())) | |
| 335 | + fs.add(f); | |
| 336 | + | |
| 337 | + if(f.getName().equals(order)) | |
| 338 | + orderField = f; | |
| 339 | + } | |
| 340 | + //过滤数据 | |
| 341 | + for(GpsEntity gps : list){ | |
| 342 | + if(fieldEquals(fs, gps, map)) | |
| 343 | + rs.add(gps); | |
| 344 | + } | |
| 345 | + | |
| 346 | + //排序 | |
| 347 | + if(null != orderField) | |
| 348 | + sortGpsList(orderField, rs); | |
| 349 | + | |
| 350 | + //分页 | |
| 351 | + int count = rs.size() | |
| 352 | + ,s = page * size, e = s + size; | |
| 353 | + if (e > count) | |
| 354 | + e = count; | |
| 355 | + | |
| 356 | + rsMap.put("list", rs.subList(s, e)); | |
| 357 | + rsMap.put("totalPages", count % size == 0 ? count / size : count / size + 1); | |
| 358 | + rsMap.put("page", page); | |
| 359 | + rsMap.put("status", ResponseCode.SUCCESS); | |
| 360 | + }catch(Exception e){ | |
| 361 | + logger.error("", e); | |
| 362 | + rsMap.put("status", ResponseCode.ERROR); | |
| 363 | + } | |
| 364 | + return rsMap; | |
| 365 | + } | |
| 366 | + | |
| 367 | + private void sortGpsList(final Field f, List<GpsEntity> rs) { | |
| 368 | + Collections.sort(rs, new Comparator<GpsEntity>() { | |
| 369 | + | |
| 370 | + @Override | |
| 371 | + public int compare(GpsEntity o1, GpsEntity o2) { | |
| 372 | + try { | |
| 373 | + if(f.get(o1) == f.get(o2)) | |
| 374 | + return 0; | |
| 375 | + | |
| 376 | + if(null == f.get(o1)) | |
| 377 | + return 1; | |
| 378 | + | |
| 379 | + if(null == f.get(o2)) | |
| 380 | + return -1; | |
| 381 | + | |
| 382 | + return f.get(o1).toString().compareTo(f.get(o2).toString()); | |
| 383 | + } catch (Exception e) { | |
| 384 | + logger.error("", e); | |
| 385 | + return -1; | |
| 386 | + } | |
| 387 | + } | |
| 388 | + }); | |
| 389 | + } | |
| 390 | + | |
| 391 | + public boolean fieldEquals(List<Field> fs, Object obj, Map<String, Object> map){ | |
| 392 | + try{ | |
| 393 | + for(Field f : fs){ | |
| 394 | + if(f.get(obj).toString().indexOf(map.get(f.getName()).toString()) == -1) | |
| 395 | + return false; | |
| 396 | + } | |
| 397 | + }catch(Exception e){ | |
| 398 | + logger.error("", e); | |
| 399 | + return false; | |
| 400 | + } | |
| 401 | + return true; | |
| 402 | + } | |
| 310 | 403 | } | ... | ... |
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| ... | ... | @@ -11,8 +11,12 @@ import java.util.Map; |
| 11 | 11 | import java.util.Properties; |
| 12 | 12 | |
| 13 | 13 | import org.springframework.beans.factory.annotation.Autowired; |
| 14 | +import org.springframework.data.jpa.repository.EntityGraph; | |
| 14 | 15 | import org.springframework.stereotype.Service; |
| 15 | 16 | |
| 17 | +import com.alibaba.fastjson.JSON; | |
| 18 | +import com.alibaba.fastjson.JSONArray; | |
| 19 | +import com.alibaba.fastjson.serializer.PropertyFilter; | |
| 16 | 20 | import com.bsth.common.ResponseCode; |
| 17 | 21 | import com.bsth.entity.Line; |
| 18 | 22 | import com.bsth.entity.Station; |
| ... | ... | @@ -25,6 +29,8 @@ import com.bsth.service.StationRouteService; |
| 25 | 29 | import com.bsth.util.FTPClientUtils; |
| 26 | 30 | import com.bsth.util.PackTarGZUtils; |
| 27 | 31 | import com.bsth.util.db.DBUtils_MS; |
| 32 | +import com.google.common.base.Splitter; | |
| 33 | +import com.google.common.collect.Lists; | |
| 28 | 34 | |
| 29 | 35 | /** |
| 30 | 36 | * |
| ... | ... | @@ -971,4 +977,41 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ |
| 971 | 977 | |
| 972 | 978 | return resultList; |
| 973 | 979 | } |
| 980 | + | |
| 981 | + @Override | |
| 982 | + public Map<String, Object> findByMultiLine(String lineIds) { | |
| 983 | + Map<String, Object> rs = new HashMap<>(); | |
| 984 | + try{ | |
| 985 | + List<String> idx = Splitter.on(',').splitToList(lineIds); | |
| 986 | + //路由 | |
| 987 | + List<StationRoute> list = new ArrayList<>(); | |
| 988 | + /** | |
| 989 | + * in 查询符 无法和 @EntityGraph 同时配合使用,这可能是一个bug | |
| 990 | + * 暂时只能循环单线路查询 | |
| 991 | + */ | |
| 992 | + //repository.multiLine(idx) | |
| 993 | + for(String id : idx){ | |
| 994 | + list.addAll(repository.findByLineCode(id)); | |
| 995 | + } | |
| 996 | + | |
| 997 | + //过滤部分字段 | |
| 998 | + String jsonStr = JSON.toJSONString(list, new PropertyFilter() { | |
| 999 | + | |
| 1000 | + @Override | |
| 1001 | + public boolean apply(Object object, String name, Object value) { | |
| 1002 | + if(name.equals("line")) | |
| 1003 | + return false; | |
| 1004 | + return true; | |
| 1005 | + } | |
| 1006 | + }); | |
| 1007 | + | |
| 1008 | + rs.put("status", ResponseCode.SUCCESS); | |
| 1009 | + rs.put("list", jsonStr); | |
| 1010 | + }catch(Exception e){ | |
| 1011 | + logger.error("", e); | |
| 1012 | + rs.put("status", ResponseCode.ERROR); | |
| 1013 | + } | |
| 1014 | + | |
| 1015 | + return rs; | |
| 1016 | + } | |
| 974 | 1017 | } | ... | ... |
src/main/resources/static/assets/js/common.js
| ... | ... | @@ -11,27 +11,27 @@ function removeConfirm(text, url, success) { |
| 11 | 11 | skin : 'layui-layer-cfm-delete' |
| 12 | 12 | }, function(){ |
| 13 | 13 | layer.msg('正在删除...', {icon: 16}); |
| 14 | - | |
| 14 | + | |
| 15 | 15 | $post(url, {'_method': 'delete'},function(rs){ |
| 16 | - layer.msg('删除成功!'); | |
| 16 | + layer.msg('删除成功!'); | |
| 17 | 17 | success && success(rs); |
| 18 | 18 | }); |
| 19 | 19 | }); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | -function html_encode(str) { | |
| 23 | - var s = ""; | |
| 24 | - if (str.length == 0) return ""; | |
| 25 | - | |
| 26 | - s = str.replace(/&/g, ">"); | |
| 27 | - s = s.replace(/</g, "<"); | |
| 28 | - s = s.replace(/>/g, ">"); | |
| 29 | - s = s.replace(/ /g, " "); | |
| 30 | - s = s.replace(/\'/g, "'"); | |
| 31 | - s = s.replace(/\"/g, """); | |
| 32 | - return s; | |
| 33 | -} | |
| 34 | - | |
| 22 | +function html_encode(str) { | |
| 23 | + var s = ""; | |
| 24 | + if (str.length == 0) return ""; | |
| 25 | + | |
| 26 | + s = str.replace(/&/g, ">"); | |
| 27 | + s = s.replace(/</g, "<"); | |
| 28 | + s = s.replace(/>/g, ">"); | |
| 29 | + s = s.replace(/ /g, " "); | |
| 30 | + s = s.replace(/\'/g, "'"); | |
| 31 | + s = s.replace(/\"/g, """); | |
| 32 | + return s; | |
| 33 | +} | |
| 34 | + | |
| 35 | 35 | |
| 36 | 36 | function successHandle(json, handle){ |
| 37 | 37 | var status = json.status; |
| ... | ... | @@ -40,14 +40,14 @@ function successHandle(json, handle){ |
| 40 | 40 | location.reload(true); |
| 41 | 41 | return; |
| 42 | 42 | } |
| 43 | - | |
| 43 | + | |
| 44 | 44 | if(!status){ |
| 45 | 45 | handle && handle(json); |
| 46 | 46 | return ; |
| 47 | 47 | } |
| 48 | - | |
| 48 | + | |
| 49 | 49 | if(status == 'ERROR') |
| 50 | - layer.alert(json.msg?json.msg:'未知异常', {icon: 2, title: '操作失败'}); | |
| 50 | + layer.alert(json.msg?json.msg:'未知异常', {icon: 2, title: '操作失败'}); | |
| 51 | 51 | else |
| 52 | 52 | handle && handle(json); |
| 53 | 53 | } |
| ... | ... | @@ -109,12 +109,12 @@ function putFormData(json, fId){ |
| 109 | 109 | * @param data |
| 110 | 110 | */ |
| 111 | 111 | function initPinYinSelect2(selector, data, cb){ |
| 112 | - | |
| 112 | + | |
| 113 | 113 | $.each(data, function(){ |
| 114 | 114 | this.fullChars = pinyin.getFullChars(this.text).toUpperCase(); |
| 115 | 115 | this.camelChars = pinyin.getCamelChars(this.text); |
| 116 | 116 | }); |
| 117 | - | |
| 117 | + | |
| 118 | 118 | $.fn.select2.amd.require(['select2/compat/matcher'], function (oldMatcher) { |
| 119 | 119 | $(selector).select2({ |
| 120 | 120 | data: data, |
| ... | ... | @@ -123,14 +123,14 @@ function initPinYinSelect2(selector, data, cb){ |
| 123 | 123 | if(item.fullChars.indexOf(upTerm) != -1 |
| 124 | 124 | || item.camelChars.indexOf(upTerm) != -1) |
| 125 | 125 | return true; |
| 126 | - | |
| 126 | + | |
| 127 | 127 | return text.indexOf(term) != -1; |
| 128 | 128 | }) |
| 129 | 129 | }); |
| 130 | - | |
| 130 | + | |
| 131 | 131 | cb && cb($(selector)); |
| 132 | 132 | }); |
| 133 | - | |
| 133 | + | |
| 134 | 134 | return $(selector); |
| 135 | 135 | } |
| 136 | 136 | |
| ... | ... | @@ -148,7 +148,7 @@ function createTreeData(arr){ |
| 148 | 148 | if(!pId){ |
| 149 | 149 | treeData.push(arr[i]); |
| 150 | 150 | } |
| 151 | - | |
| 151 | + | |
| 152 | 152 | for(var j = 0; j < len; j ++){ |
| 153 | 153 | if(pId == arr[j].id){ |
| 154 | 154 | if(!arr[j].children) |
| ... | ... | @@ -204,4 +204,4 @@ function createVehSearch($e){ |
| 204 | 204 | } |
| 205 | 205 | }) |
| 206 | 206 | return $e; |
| 207 | -} | |
| 208 | 207 | \ No newline at end of file |
| 208 | +} | ... | ... |
src/main/resources/static/pages/control/line/child_pages/historyDirective.html
| ... | ... | @@ -54,7 +54,7 @@ |
| 54 | 54 | <span class="label label-sm label-danger">{{item.errorText}}</span> |
| 55 | 55 | {{else}} |
| 56 | 56 | {{if item.reply46 != 0}} |
| 57 | - <span class="label label-sm label-danger">设备无响应</span> | |
| 57 | + <span class="label label-sm label-danger">设备未响应</span> | |
| 58 | 58 | {{else if item.reply47 != 0}} |
| 59 | 59 | <span class="label label-sm label-warning">驾驶员未确认</span> |
| 60 | 60 | {{/if}} | ... | ... |
src/main/resources/static/pages/control/line/css/lineControl.css
| ... | ... | @@ -2663,4 +2663,17 @@ tr._home_tr_active abbr.abnormal{ |
| 2663 | 2663 | bottom: 20px; |
| 2664 | 2664 | right: 20px; |
| 2665 | 2665 | color: #d0d0d0; |
| 2666 | +} | |
| 2667 | + | |
| 2668 | +.banner .dropdown-menu { | |
| 2669 | + background-color: #ffffff; | |
| 2670 | + font-size: 13px; | |
| 2671 | +} | |
| 2672 | +.banner .dropdown-menu { | |
| 2673 | + box-shadow: 0 2px 5px 0 rgba(48, 164, 244, 0.24),0 2px 10px 0 rgba(48, 164, 244, 0.24); | |
| 2674 | +} | |
| 2675 | + | |
| 2676 | +.banner .dropdown-menu > li:hover > a{ | |
| 2677 | + background-color: #679bbe; | |
| 2678 | + color: white !important; | |
| 2666 | 2679 | } |
| 2667 | 2680 | \ No newline at end of file | ... | ... |
src/main/resources/static/pages/control/line/js/data.js
| ... | ... | @@ -323,14 +323,18 @@ var _data = (function(){ |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | function abnormalCheck(gps){ |
| 326 | + if(!stationRoute[gps.lineId]) | |
| 327 | + return; | |
| 326 | 328 | var routes = stationRoute[gps.lineId][gps.upDown] |
| 327 | 329 | ,rs; |
| 328 | - $.each(routes , function(){ | |
| 329 | - if(this.stationCode == gps.stopNo){ | |
| 330 | - rs = 1; | |
| 331 | - return false; | |
| 332 | - } | |
| 333 | - }); | |
| 330 | + if(routes){ | |
| 331 | + $.each(routes , function(){ | |
| 332 | + if(this.stationCode == gps.stopNo){ | |
| 333 | + rs = 1; | |
| 334 | + return false; | |
| 335 | + } | |
| 336 | + }); | |
| 337 | + } | |
| 334 | 338 | |
| 335 | 339 | if(!rs){ |
| 336 | 340 | gps.abnormal = true; | ... | ... |
src/main/resources/static/pages/control/line/js/toolbarEvent.js
| ... | ... | @@ -22,7 +22,7 @@ var _toolbarEvent = (function(){ |
| 22 | 22 | type: 1, |
| 23 | 23 | area: '980px', |
| 24 | 24 | content: content, |
| 25 | - title : false, | |
| 25 | + title : '指令下发记录', | |
| 26 | 26 | shift: 5, |
| 27 | 27 | success: function(){ |
| 28 | 28 | } |
| ... | ... | @@ -37,7 +37,7 @@ var _toolbarEvent = (function(){ |
| 37 | 37 | type: 1, |
| 38 | 38 | area: '930px', |
| 39 | 39 | content: content, |
| 40 | - title : false, | |
| 40 | + title : '设备上报', | |
| 41 | 41 | shift: 5, |
| 42 | 42 | success: function(){ |
| 43 | 43 | |
| ... | ... | @@ -53,7 +53,7 @@ var _toolbarEvent = (function(){ |
| 53 | 53 | type: 1, |
| 54 | 54 | area: '530px', |
| 55 | 55 | content: content, |
| 56 | - title : false, | |
| 56 | + title : 'TTS', | |
| 57 | 57 | shift: 5, |
| 58 | 58 | success: function(){ |
| 59 | 59 | } |
| ... | ... | @@ -61,6 +61,22 @@ var _toolbarEvent = (function(){ |
| 61 | 61 | }); |
| 62 | 62 | }); |
| 63 | 63 | |
| 64 | + //设备管理 | |
| 65 | + $('#deviceConfig').on('click', function(){ | |
| 66 | + $.get('/pages/control/line/child_pages/deviceConfig.html', function(content){ | |
| 67 | + layer.open({ | |
| 68 | + type: 1, | |
| 69 | + area: '530px', | |
| 70 | + content: content, | |
| 71 | + title : '设备管理', | |
| 72 | + shift: 5, | |
| 73 | + success: function(){ | |
| 74 | + } | |
| 75 | + }); | |
| 76 | + }); | |
| 77 | + }); | |
| 78 | + | |
| 79 | + //更新日志 | |
| 64 | 80 | $('#updateLogLink').on('click', function(){ |
| 65 | 81 | layer.alert(updateLog.text, { |
| 66 | 82 | title: updateLog.title, | ... | ... |