Commit d8eed84ec5522b5dede9135856f320326aaece09
1 parent
2ce9bb69
1.对接中运量调度 新增接口
Showing
2 changed files
with
505 additions
and
452 deletions
src/main/java/com/bsth/controller/realcontrol/ServiceDataInterface.java
| ... | ... | @@ -234,6 +234,59 @@ public class ServiceDataInterface { |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | /** |
| 237 | + * 向指定的车辆下发指令 | |
| 238 | + * 中运量用 | |
| 239 | + * @return | |
| 240 | + */ | |
| 241 | + @RequestMapping(value = "/send60Phrase/zyl", method = RequestMethod.POST) | |
| 242 | + public int send60PhraseZyl(@RequestBody Map<String, String> map, @RequestParam String secretKey) { | |
| 243 | + try { | |
| 244 | + String plate = map.get("plate"); | |
| 245 | + String txt = map.get("txt"); | |
| 246 | + String sender = map.get("sender"); | |
| 247 | + short dispatchInstruct = Short.parseShort(map.get("instructionType")); | |
| 248 | + int direction = Integer.parseInt(map.get("direction")); | |
| 249 | + long alarmTime = Long.parseLong(map.get("alarmTime")); | |
| 250 | + if (txt.length() > 50) | |
| 251 | + txt = txt.substring(0, 50); | |
| 252 | + if (StringUtils.isEmpty(secretKey) || !secretKey.equals(SECRE_KEY)) | |
| 253 | + return -500; | |
| 254 | + | |
| 255 | + //车辆和设备号对照 | |
| 256 | + String nbbm = BasicData.nbbmCompanyPlateMap.inverse().get(plate); | |
| 257 | + String deviceId = BasicData.deviceId2NbbmMap.inverse().get(nbbm); | |
| 258 | + if (StringUtils.isEmpty(deviceId)) | |
| 259 | + return -404; | |
| 260 | + | |
| 261 | + //检查设备是否在线 | |
| 262 | + long t = System.currentTimeMillis(); | |
| 263 | + GpsEntity gps = gpsRealData.get(deviceId); | |
| 264 | + if (null == gps || (t - gps.getServerTimestamp()) > 1000 * 60 * 5) | |
| 265 | + return -405; | |
| 266 | + | |
| 267 | + D60 d60 = null; | |
| 268 | + if (dispatchInstruct == 2) { | |
| 269 | + d60 = new DirectiveCreator().createD60_02(nbbm, txt, direction, 0, new Date(alarmTime)); | |
| 270 | + } else { | |
| 271 | + d60 = new DirectiveCreator().createD60(nbbm, txt, dispatchInstruct, direction, 0, gps.getLineId()); | |
| 272 | + } | |
| 273 | + d60.setSender(sender); | |
| 274 | + // 发送指令 | |
| 275 | + int code = GatewayHttpUtils.postJson(JSON.toJSONString(d60)); | |
| 276 | + d60.setHttpCode(code); | |
| 277 | + | |
| 278 | + if (code != 0) | |
| 279 | + d60.setErrorText("网关通讯失败, code: " + code); | |
| 280 | + | |
| 281 | + dayOfDirectives.put60(d60); | |
| 282 | + return d60.getMsgId(); | |
| 283 | + } catch (Exception e) { | |
| 284 | + logger.error("", e); | |
| 285 | + return -500; | |
| 286 | + } | |
| 287 | + } | |
| 288 | + | |
| 289 | + /** | |
| 237 | 290 | * 根据msg id 查询指令响应情况 |
| 238 | 291 | * |
| 239 | 292 | * @param msgIds | ... | ... |
src/main/java/com/bsth/data/BasicData.java
| 1 | -package com.bsth.data; | |
| 2 | - | |
| 3 | -import java.text.DateFormat; | |
| 4 | -import java.text.SimpleDateFormat; | |
| 5 | -import java.util.ArrayList; | |
| 6 | -import java.util.Calendar; | |
| 7 | -import java.util.Date; | |
| 8 | -import java.util.HashMap; | |
| 9 | -import java.util.HashSet; | |
| 10 | -import java.util.Iterator; | |
| 11 | -import java.util.List; | |
| 12 | -import java.util.Map; | |
| 13 | -import java.util.Set; | |
| 14 | - | |
| 15 | -import org.apache.commons.lang3.StringUtils; | |
| 16 | -import org.slf4j.Logger; | |
| 17 | -import org.slf4j.LoggerFactory; | |
| 18 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | -import org.springframework.stereotype.Component; | |
| 20 | - | |
| 21 | -import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | |
| 22 | -import com.bsth.data.pinyin.PersionPinYinBuffer; | |
| 23 | -import com.bsth.entity.Business; | |
| 24 | -import com.bsth.entity.CarPark; | |
| 25 | -import com.bsth.entity.Cars; | |
| 26 | -import com.bsth.entity.Line; | |
| 27 | -import com.bsth.entity.Personnel; | |
| 28 | -import com.bsth.entity.StationRoute; | |
| 29 | -import com.bsth.entity.calc.CalcInterval; | |
| 30 | -import com.bsth.entity.schedule.CarConfigInfo; | |
| 31 | -import com.bsth.repository.BusinessRepository; | |
| 32 | -import com.bsth.repository.CarParkRepository; | |
| 33 | -import com.bsth.repository.CarsRepository; | |
| 34 | -import com.bsth.repository.LineRepository; | |
| 35 | -import com.bsth.repository.PersonnelRepository; | |
| 36 | -import com.bsth.repository.StationRepository; | |
| 37 | -import com.bsth.repository.StationRouteRepository; | |
| 38 | -import com.bsth.repository.calc.CalcIntervalRepository; | |
| 39 | -import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 40 | -import com.google.common.collect.BiMap; | |
| 41 | -import com.google.common.collect.HashBiMap; | |
| 42 | - | |
| 43 | -/** | |
| 44 | - * @author PanZhao | |
| 45 | - * @ClassName: BasicData | |
| 46 | - * @Description: TODO(基础的映射数据) | |
| 47 | - * @date 2016年8月10日 下午3:27:45 | |
| 48 | - */ | |
| 49 | -@Component | |
| 50 | -public class BasicData { | |
| 51 | - | |
| 52 | - //公司代码和公司名对照(K: 公司编码,V:公司名) | |
| 53 | - public static Map<String, String> businessCodeNameMap; | |
| 54 | - | |
| 55 | - //分公司公司代码和分公司公司名对照(K: 分公司编码_公司编码,V:分公司公司名) | |
| 56 | - public static Map<String, String> businessFgsCodeNameMap; | |
| 57 | - | |
| 58 | - //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) | |
| 59 | - public static BiMap<String, String> deviceId2NbbmMap; | |
| 60 | - | |
| 61 | - //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) | |
| 62 | - public static Map<String, String> nbbm2CompanyCodeMap; | |
| 63 | - | |
| 64 | - //车辆自编号和分公司代码对照 (K: 车辆自编号 ,V:分公司编码_公司编码) | |
| 65 | - public static Map<String, String> nbbm2FgsCompanyCodeMap; | |
| 66 | - | |
| 67 | - //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号) | |
| 68 | - public static Map<String, String> nbbmCompanyPlateMap; | |
| 69 | - | |
| 70 | - //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称) | |
| 71 | - public static Map<String, String> stationCode2NameMap; | |
| 72 | - | |
| 73 | - //车辆和线路对照 | |
| 74 | - public static Map<String, Line> nbbm2LineMap; | |
| 75 | - | |
| 76 | - //线路历史配车(K: 线路编码 ,V:List<车辆自编号>) | |
| 77 | - public static Map<String, List<String>> lineCodeHistoryNbbmMap; | |
| 78 | - | |
| 79 | - //线路ID和code 对照 | |
| 80 | - public static BiMap<Integer, String> lineId2CodeMap; | |
| 81 | - | |
| 82 | - //线路编码和名称对照 | |
| 83 | - public static Map<String, String> lineCode2NameMap; | |
| 84 | - | |
| 85 | - public static Map<String, String> lineCodeAllNameMap; | |
| 86 | - //停车场 | |
| 87 | - public static List<String> parkCodeList; | |
| 88 | - | |
| 89 | - //线路ID和shangHaiLinecode 对照 | |
| 90 | - public static Map<Integer, String> lineId2ShangHaiCodeMap; | |
| 91 | - | |
| 92 | - //线路Code和shangHaiLinecode 对照 | |
| 93 | - public static Map<String, String> lineCode2ShangHaiCodeMap; | |
| 94 | - | |
| 95 | - /*//驾驶员工号 和 personnel 对象映射 | |
| 96 | - public static Map<String, Personnel> jsyMap; | |
| 97 | - //售票员工号 和 personnel 对象映射 | |
| 98 | - public static Map<String, Personnel> spyMap;*/ | |
| 99 | - //所以员工和personnerl 对象映射 | |
| 100 | - public static Map<String, Personnel> perMap; | |
| 101 | - //全量员工 工号和姓名对照 | |
| 102 | - public static Map<String, String> allPerson; | |
| 103 | - | |
| 104 | - //站点名和运管处编号 对照 | |
| 105 | - public static Map<String, Integer> stationName2YgcNumber; | |
| 106 | - | |
| 107 | - // 线路编码_日期 等级 | |
| 108 | - public static Map<String, String> lineDate2Level; | |
| 109 | - | |
| 110 | - static Logger logger = LoggerFactory.getLogger(BasicData.class); | |
| 111 | - | |
| 112 | - public static String getStationNameByCode(String code, String prefix){ | |
| 113 | - String name = stationCode2NameMap.get(code); | |
| 114 | - return name != null? name: stationCode2NameMap.get(prefix + code); | |
| 115 | - } | |
| 116 | - | |
| 117 | -/* @Autowired | |
| 118 | - JdbcTemplate jdbcTemplate; | |
| 119 | - public Map<String, String> getNbbm2PlateNo(){ | |
| 120 | - List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); | |
| 121 | - | |
| 122 | - Map<String, String> rs = new HashMap<>(); | |
| 123 | - for(Map<String, Object> map : list){ | |
| 124 | - rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | |
| 125 | - } | |
| 126 | - return rs; | |
| 127 | - }*/ | |
| 128 | - | |
| 129 | - @Component | |
| 130 | - public static class BasicDataLoader extends Thread { | |
| 131 | - | |
| 132 | - @Autowired | |
| 133 | - CarsRepository carsRepository; | |
| 134 | - | |
| 135 | - @Autowired | |
| 136 | - StationRepository stationRepository; | |
| 137 | - | |
| 138 | - @Autowired | |
| 139 | - CarParkRepository carParkRepository; | |
| 140 | - | |
| 141 | - @Autowired | |
| 142 | - CarConfigInfoRepository carConfigInfoRepository; | |
| 143 | - | |
| 144 | - @Autowired | |
| 145 | - LineRepository lineRepository; | |
| 146 | - | |
| 147 | - @Autowired | |
| 148 | - StationRouteRepository stationRouteRepository; | |
| 149 | - | |
| 150 | - @Autowired | |
| 151 | - PersonnelRepository personnelRepository; | |
| 152 | - | |
| 153 | - @Autowired | |
| 154 | - BusinessRepository businessRepository; | |
| 155 | - | |
| 156 | - @Autowired | |
| 157 | - GeoCacheData geoCacheData; | |
| 158 | - | |
| 159 | - @Autowired | |
| 160 | - Station2ParkBuffer station2ParkBuffer; | |
| 161 | - | |
| 162 | - @Autowired | |
| 163 | - PersionPinYinBuffer persionPinYinBuffer; | |
| 164 | - | |
| 165 | - @Autowired | |
| 166 | - CalcIntervalRepository calcIntervalRepository; | |
| 167 | - | |
| 168 | - @Override | |
| 169 | - public void run() { | |
| 170 | - loadAllData(); | |
| 171 | - } | |
| 172 | - | |
| 173 | - /** | |
| 174 | - * @Title: loadAllData | |
| 175 | - * @Description: TODO(加载所有数据) | |
| 176 | - */ | |
| 177 | - public int loadAllData() { | |
| 178 | - try { | |
| 179 | - logger.info("开始加载基础数据..,"); | |
| 180 | - //设备信息 | |
| 181 | - loadDeviceInfo(); | |
| 182 | - //站点信息 | |
| 183 | - loadStationInfo(); | |
| 184 | - //线路信息 | |
| 185 | - loadLineInfo(); | |
| 186 | - //车辆和线路映射信息 | |
| 187 | - loadNbbm2LineInfo(); | |
| 188 | - loadLineCodeHistoryNbbmMapInfo(); | |
| 189 | - //人员信息 | |
| 190 | - loadPersonnelInfo(); | |
| 191 | - //公司信息 | |
| 192 | - loadBusinessInfo(); | |
| 193 | - // 线路等级信息 | |
| 194 | - loadLineLevel(); | |
| 195 | - | |
| 196 | - logger.info("load geo cache..,"); | |
| 197 | - geoCacheData.loadData(); | |
| 198 | - station2ParkBuffer.saveAll(); | |
| 199 | - logger.info("加载基础数据成功!,"); | |
| 200 | - } catch (Exception e) { | |
| 201 | - logger.error("加载基础数据时出现异常,", e); | |
| 202 | - } | |
| 203 | - return 0; | |
| 204 | - } | |
| 205 | - | |
| 206 | - /** | |
| 207 | - * loadBusinessInfo | |
| 208 | - * (公司代码公司名对照) | |
| 209 | - */ | |
| 210 | - public void loadBusinessInfo() { | |
| 211 | - Map<String, String> businessMap = new HashMap<String, String>(); | |
| 212 | - Map<String, String> businessFgsMap = new HashMap<String, String>(); | |
| 213 | - Iterator<Business> busIter = businessRepository.findAll().iterator(); | |
| 214 | - Business t; | |
| 215 | - while (busIter.hasNext()) { | |
| 216 | - t = busIter.next(); | |
| 217 | - businessMap.put(t.getBusinessCode(), t.getBusinessName()); | |
| 218 | - businessFgsMap.put(t.getBusinessCode() + "_" + t.getUpCode(), t.getBusinessName()); | |
| 219 | - } | |
| 220 | - businessCodeNameMap = businessMap; | |
| 221 | - businessFgsCodeNameMap = businessFgsMap; | |
| 222 | - } | |
| 223 | - | |
| 224 | - /** | |
| 225 | - * @Title: loadDeviceInfo | |
| 226 | - * @Description: TODO(加载设备相关信息) | |
| 227 | - */ | |
| 228 | - public void loadDeviceInfo() { | |
| 229 | - BiMap<String, String> deviceId2Nbbm = HashBiMap.create(); | |
| 230 | - //车辆和公司代码对照 | |
| 231 | - Map<String, String> nbbm2CompanyCode = new HashMap<>(); | |
| 232 | - //车辆和分公司代码对照 | |
| 233 | - Map<String, String> nbbm2FgsCompanyCode = new HashMap<>(); | |
| 234 | - | |
| 235 | - //车辆自编号和拍照号对照 | |
| 236 | - Map<String, String> nbbmCompanyPlate = new HashMap<>(); | |
| 237 | - | |
| 238 | - Iterator<Cars> carIterator = carsRepository.findAll().iterator(); | |
| 239 | - Cars car; | |
| 240 | - while (carIterator.hasNext()) { | |
| 241 | - car = carIterator.next(); | |
| 242 | - deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); | |
| 243 | - nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); | |
| 244 | - nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() ); | |
| 245 | - nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate()); | |
| 246 | - } | |
| 247 | - | |
| 248 | - deviceId2NbbmMap = deviceId2Nbbm; | |
| 249 | - nbbm2CompanyCodeMap = nbbm2CompanyCode; | |
| 250 | - nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode; | |
| 251 | - nbbmCompanyPlateMap =nbbmCompanyPlate; | |
| 252 | - } | |
| 253 | - | |
| 254 | - /** | |
| 255 | - * @Title: loadStationInfo | |
| 256 | - * @Description: TODO(加载站点信息) | |
| 257 | - */ | |
| 258 | - public void loadStationInfo() { | |
| 259 | - Map<String, String> stationCode2Name = new HashMap<>(); | |
| 260 | - Iterator<StationRoute> iterator = stationRouteRepository.findAll().iterator(); | |
| 261 | - StationRoute sroute; | |
| 262 | - while (iterator.hasNext()) { | |
| 263 | - sroute = iterator.next(); | |
| 264 | - stationCode2Name.put(sroute.getLineCode() + "_" + sroute.getDirections() + "_" + sroute.getStationCode(), sroute.getStationName()); | |
| 265 | - } | |
| 266 | - | |
| 267 | - //停车场 | |
| 268 | - Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator(); | |
| 269 | - | |
| 270 | - List<String> parkCodes = new ArrayList<>(); | |
| 271 | - | |
| 272 | - CarPark carPark; | |
| 273 | - while (iterator2.hasNext()) { | |
| 274 | - carPark = iterator2.next(); | |
| 275 | - stationCode2Name.put(carPark.getParkCode(), carPark.getParkName()); | |
| 276 | - | |
| 277 | - parkCodes.add(carPark.getParkCode()); | |
| 278 | - } | |
| 279 | - parkCodeList = parkCodes; | |
| 280 | - stationCode2NameMap = stationCode2Name; | |
| 281 | - } | |
| 282 | - | |
| 283 | - /** | |
| 284 | - * @Title: loadNbbm2LineInfo | |
| 285 | - * @Description: TODO(车辆和线路对照) | |
| 286 | - */ | |
| 287 | - public void loadNbbm2LineInfo() { | |
| 288 | - Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 289 | - Map<String, Line> ccMap = new HashMap<>(); | |
| 290 | - | |
| 291 | - CarConfigInfo cci; | |
| 292 | - while (allIterator.hasNext()) { | |
| 293 | - cci = allIterator.next(); | |
| 294 | - if(cci.getIsCancel()) | |
| 295 | - continue;//排除已经报废的 | |
| 296 | - ccMap.put(cci.getCl().getInsideCode(), cci.getXl()); | |
| 297 | - } | |
| 298 | - nbbm2LineMap = ccMap; | |
| 299 | - } | |
| 300 | - | |
| 301 | - /** | |
| 302 | - * @Title: loadLineCodeHistoryNbbmMapInfo | |
| 303 | - * @Description: TODO(线路历史配车) | |
| 304 | - */ | |
| 305 | - public void loadLineCodeHistoryNbbmMapInfo() { | |
| 306 | - Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 307 | - Map<String, List<String>> ccMap = new HashMap<>(); //用list保持排序 | |
| 308 | - Map<String, Set<String>> sMap = new HashMap<>(); //用Set去重 | |
| 309 | - | |
| 310 | - CarConfigInfo cci; | |
| 311 | - while (allIterator.hasNext()) { | |
| 312 | - cci = allIterator.next(); | |
| 313 | - String lineCode = cci.getXl().getLineCode(); | |
| 314 | - if(!ccMap.containsKey(lineCode)){ | |
| 315 | - ccMap.put(lineCode, new ArrayList<String>()); | |
| 316 | - sMap.put(lineCode, new HashSet<String>()); | |
| 317 | - } | |
| 318 | - if(sMap.get(lineCode).add(cci.getCl().getInsideCode())){ | |
| 319 | - ccMap.get(lineCode).add(cci.getCl().getInsideCode()); | |
| 320 | - } | |
| 321 | - } | |
| 322 | - lineCodeHistoryNbbmMap = ccMap; | |
| 323 | - } | |
| 324 | - | |
| 325 | - /** | |
| 326 | - * @Title: loadLineInfo | |
| 327 | - * @Description: TODO(加载线路相关信息) | |
| 328 | - */ | |
| 329 | - public void loadLineInfo() { | |
| 330 | - Iterator<Line> iterator = lineRepository.findAllService().iterator(); | |
| 331 | - | |
| 332 | - Line line; | |
| 333 | - BiMap<Integer, String> biMap = HashBiMap.create(); | |
| 334 | - Map<String, String> code2name = new HashMap<>(); | |
| 335 | - Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); | |
| 336 | - Map<String, String> code2SHcode = new HashMap<String, String>(); | |
| 337 | - Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); | |
| 338 | - | |
| 339 | - /** | |
| 340 | - * 加载运管处的站点及序号 | |
| 341 | - * 上行从1开始,下行顺序续编 | |
| 342 | - */ | |
| 343 | - List<Map<String, String>> ygcLines = stationRouteRepository.findAllLineWithYgc(); | |
| 344 | - if(ygcLines != null && ygcLines.size() > 0){ | |
| 345 | - int size = ygcLines.size(); | |
| 346 | - Map<String, String> tempMap ; | |
| 347 | - int num = 1; | |
| 348 | - String key; | |
| 349 | - String lineCode = ""; | |
| 350 | - for (int i = 0; i < size; i ++){ | |
| 351 | - tempMap = ygcLines.get(i); | |
| 352 | - if(lineCode.equals("")){ | |
| 353 | - lineCode = tempMap.get("lineCode"); | |
| 354 | - }else if(!lineCode.equals(tempMap.get("lineCode"))){ | |
| 355 | - num = 1; | |
| 356 | - lineCode = tempMap.get("lineCode"); | |
| 357 | - } | |
| 358 | - key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | |
| 359 | - + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | |
| 360 | - tempStationName2YgcNumber.put(key,num++); | |
| 361 | - } | |
| 362 | - } | |
| 363 | - | |
| 364 | - while (iterator.hasNext()) { | |
| 365 | - line = iterator.next(); | |
| 366 | - biMap.put(line.getId(), line.getLineCode()); | |
| 367 | - code2name.put(line.getLineCode(), line.getName()); | |
| 368 | - id2SHcode.put(line.getId(), line.getShanghaiLinecode()); | |
| 369 | - code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | |
| 370 | - } | |
| 371 | - | |
| 372 | - lineId2CodeMap = biMap; | |
| 373 | - lineCode2NameMap = code2name; | |
| 374 | - lineId2ShangHaiCodeMap = id2SHcode; | |
| 375 | - lineCode2ShangHaiCodeMap = code2SHcode; | |
| 376 | - stationName2YgcNumber = tempStationName2YgcNumber; | |
| 377 | - | |
| 378 | - Map<String, String> code2nameAll = new HashMap<>(); | |
| 379 | - Iterator<Line> iteratorAll = lineRepository.findAll().iterator(); | |
| 380 | - while (iteratorAll.hasNext()) { | |
| 381 | - line = iteratorAll.next(); | |
| 382 | - code2nameAll.put(line.getLineCode(), line.getName()); | |
| 383 | - } | |
| 384 | - lineCodeAllNameMap=code2nameAll; | |
| 385 | - } | |
| 386 | - | |
| 387 | - /** | |
| 388 | - * @Title: loadPersonnelInfo | |
| 389 | - * @Description: TODO(加载人员信息) | |
| 390 | - */ | |
| 391 | - public void loadPersonnelInfo() { | |
| 392 | - Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | |
| 393 | - | |
| 394 | - Map<String, Personnel> /*jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),*/perTempMap=new HashMap<>(); | |
| 395 | - Map<String, String> allPersonMap = new HashMap<>(); | |
| 396 | - | |
| 397 | - Personnel p; | |
| 398 | - String jobCode; | |
| 399 | - while (iterator.hasNext()) { | |
| 400 | - p = iterator.next(); | |
| 401 | - | |
| 402 | - jobCode = p.getJobCode(); | |
| 403 | - if (StringUtils.isEmpty(jobCode)) | |
| 404 | - continue; | |
| 405 | - | |
| 406 | - /*if (p.getPosts() != null) { | |
| 407 | - if (p.getPosts().equals("1")) | |
| 408 | - jsyTempMap.put(jobCode, p); | |
| 409 | - else if (p.getPosts().equals("2")) | |
| 410 | - spyTempMap.put(jobCode, p); | |
| 411 | - }*/ | |
| 412 | - | |
| 413 | - perTempMap.put(jobCode, p); | |
| 414 | - | |
| 415 | - allPersonMap.put(jobCode, p.getPersonnelName()); | |
| 416 | - } | |
| 417 | - | |
| 418 | - //jsyMap = jsyTempMap; | |
| 419 | - //spyMap = spyTempMap; | |
| 420 | - allPerson = allPersonMap; | |
| 421 | - perMap = perTempMap; | |
| 422 | - | |
| 423 | - //人员拼音转换 | |
| 424 | - persionPinYinBuffer.refresh(); | |
| 425 | - } | |
| 426 | - | |
| 427 | - /** | |
| 428 | - * 加载线路级别信息 按当前日期取(当前+前后一天)的数据 | |
| 429 | - */ | |
| 430 | - public void loadLineLevel() { | |
| 431 | - List<String> dates = new ArrayList<>(); | |
| 432 | - Map<String, String> result = new HashMap<>(); | |
| 433 | - DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); | |
| 434 | - | |
| 435 | - Calendar c = Calendar.getInstance(); | |
| 436 | - c.setTime(new Date(System.currentTimeMillis() - 86400000)); | |
| 437 | - dates.add(df.format(c.getTime())); | |
| 438 | - | |
| 439 | - for (int i = 0;i < 2;i++) { | |
| 440 | - c.add(Calendar.DATE, 1); | |
| 441 | - dates.add(df.format(c.getTime())); | |
| 442 | - } | |
| 443 | - | |
| 444 | - List<CalcInterval> l = calcIntervalRepository.selectByDates(dates); | |
| 445 | - for (CalcInterval ci : l) { | |
| 446 | - result.put(ci.getXlBm() + "_" + ci.getDate(), ci.getLevel()); | |
| 447 | - } | |
| 448 | - | |
| 449 | - lineDate2Level = result; | |
| 450 | - } | |
| 451 | - } | |
| 452 | -} | |
| 1 | +package com.bsth.data; | |
| 2 | + | |
| 3 | +import java.text.DateFormat; | |
| 4 | +import java.text.SimpleDateFormat; | |
| 5 | +import java.util.ArrayList; | |
| 6 | +import java.util.Calendar; | |
| 7 | +import java.util.Date; | |
| 8 | +import java.util.HashMap; | |
| 9 | +import java.util.HashSet; | |
| 10 | +import java.util.Iterator; | |
| 11 | +import java.util.List; | |
| 12 | +import java.util.Map; | |
| 13 | +import java.util.Set; | |
| 14 | + | |
| 15 | +import org.apache.commons.lang3.StringUtils; | |
| 16 | +import org.slf4j.Logger; | |
| 17 | +import org.slf4j.LoggerFactory; | |
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 19 | +import org.springframework.stereotype.Component; | |
| 20 | + | |
| 21 | +import com.bsth.data.gpsdata_v2.cache.GeoCacheData; | |
| 22 | +import com.bsth.data.pinyin.PersionPinYinBuffer; | |
| 23 | +import com.bsth.entity.Business; | |
| 24 | +import com.bsth.entity.CarPark; | |
| 25 | +import com.bsth.entity.Cars; | |
| 26 | +import com.bsth.entity.Line; | |
| 27 | +import com.bsth.entity.Personnel; | |
| 28 | +import com.bsth.entity.StationRoute; | |
| 29 | +import com.bsth.entity.calc.CalcInterval; | |
| 30 | +import com.bsth.entity.schedule.CarConfigInfo; | |
| 31 | +import com.bsth.repository.BusinessRepository; | |
| 32 | +import com.bsth.repository.CarParkRepository; | |
| 33 | +import com.bsth.repository.CarsRepository; | |
| 34 | +import com.bsth.repository.LineRepository; | |
| 35 | +import com.bsth.repository.PersonnelRepository; | |
| 36 | +import com.bsth.repository.StationRepository; | |
| 37 | +import com.bsth.repository.StationRouteRepository; | |
| 38 | +import com.bsth.repository.calc.CalcIntervalRepository; | |
| 39 | +import com.bsth.repository.schedule.CarConfigInfoRepository; | |
| 40 | +import com.google.common.collect.BiMap; | |
| 41 | +import com.google.common.collect.HashBiMap; | |
| 42 | + | |
| 43 | +/** | |
| 44 | + * @author PanZhao | |
| 45 | + * @ClassName: BasicData | |
| 46 | + * @Description: TODO(基础的映射数据) | |
| 47 | + * @date 2016年8月10日 下午3:27:45 | |
| 48 | + */ | |
| 49 | +@Component | |
| 50 | +public class BasicData { | |
| 51 | + | |
| 52 | + //公司代码和公司名对照(K: 公司编码,V:公司名) | |
| 53 | + public static Map<String, String> businessCodeNameMap; | |
| 54 | + | |
| 55 | + //分公司公司代码和分公司公司名对照(K: 分公司编码_公司编码,V:分公司公司名) | |
| 56 | + public static Map<String, String> businessFgsCodeNameMap; | |
| 57 | + | |
| 58 | + //设备号和车辆自编号 (K: 设备编码 ,V:车辆自编号) | |
| 59 | + public static BiMap<String, String> deviceId2NbbmMap; | |
| 60 | + | |
| 61 | + //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) | |
| 62 | + public static Map<String, String> nbbm2CompanyCodeMap; | |
| 63 | + | |
| 64 | + //车辆自编号和分公司代码对照 (K: 车辆自编号 ,V:分公司编码_公司编码) | |
| 65 | + public static Map<String, String> nbbm2FgsCompanyCodeMap; | |
| 66 | + | |
| 67 | + //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号) | |
| 68 | + public static BiMap<String, String> nbbmCompanyPlateMap; | |
| 69 | + | |
| 70 | + //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称) | |
| 71 | + public static Map<String, String> stationCode2NameMap; | |
| 72 | + | |
| 73 | + //车辆和线路对照 | |
| 74 | + public static Map<String, Line> nbbm2LineMap; | |
| 75 | + | |
| 76 | + //线路历史配车(K: 线路编码 ,V:List<车辆自编号>) | |
| 77 | + public static Map<String, List<String>> lineCodeHistoryNbbmMap; | |
| 78 | + | |
| 79 | + //线路ID和code 对照 | |
| 80 | + public static BiMap<Integer, String> lineId2CodeMap; | |
| 81 | + | |
| 82 | + //线路编码和名称对照 | |
| 83 | + public static Map<String, String> lineCode2NameMap; | |
| 84 | + | |
| 85 | + public static Map<String, String> lineCodeAllNameMap; | |
| 86 | + //停车场 | |
| 87 | + public static List<String> parkCodeList; | |
| 88 | + | |
| 89 | + //线路ID和shangHaiLinecode 对照 | |
| 90 | + public static Map<Integer, String> lineId2ShangHaiCodeMap; | |
| 91 | + | |
| 92 | + //线路Code和shangHaiLinecode 对照 | |
| 93 | + public static Map<String, String> lineCode2ShangHaiCodeMap; | |
| 94 | + | |
| 95 | + /*//驾驶员工号 和 personnel 对象映射 | |
| 96 | + public static Map<String, Personnel> jsyMap; | |
| 97 | + //售票员工号 和 personnel 对象映射 | |
| 98 | + public static Map<String, Personnel> spyMap;*/ | |
| 99 | + //所以员工和personnerl 对象映射 | |
| 100 | + public static Map<String, Personnel> perMap; | |
| 101 | + //全量员工 工号和姓名对照 | |
| 102 | + public static Map<String, String> allPerson; | |
| 103 | + | |
| 104 | + //站点名和运管处编号 对照 | |
| 105 | + public static Map<String, Integer> stationName2YgcNumber; | |
| 106 | + | |
| 107 | + // 线路编码_日期 等级 | |
| 108 | + public static Map<String, String> lineDate2Level; | |
| 109 | + | |
| 110 | + static Logger logger = LoggerFactory.getLogger(BasicData.class); | |
| 111 | + | |
| 112 | + public static String getStationNameByCode(String code, String prefix){ | |
| 113 | + String name = stationCode2NameMap.get(code); | |
| 114 | + return name != null? name: stationCode2NameMap.get(prefix + code); | |
| 115 | + } | |
| 116 | + | |
| 117 | +/* @Autowired | |
| 118 | + JdbcTemplate jdbcTemplate; | |
| 119 | + public Map<String, String> getNbbm2PlateNo(){ | |
| 120 | + List<Map<String, Object>> list = jdbcTemplate.queryForList("select CAR_CODE,CAR_PLATE from bsth_c_cars where CAR_CODE is not null and CAR_PLATE is not null"); | |
| 121 | + | |
| 122 | + Map<String, String> rs = new HashMap<>(); | |
| 123 | + for(Map<String, Object> map : list){ | |
| 124 | + rs.put(map.get("CAR_CODE").toString(), map.get("CAR_PLATE").toString()); | |
| 125 | + } | |
| 126 | + return rs; | |
| 127 | + }*/ | |
| 128 | + | |
| 129 | + @Component | |
| 130 | + public static class BasicDataLoader extends Thread { | |
| 131 | + | |
| 132 | + @Autowired | |
| 133 | + CarsRepository carsRepository; | |
| 134 | + | |
| 135 | + @Autowired | |
| 136 | + StationRepository stationRepository; | |
| 137 | + | |
| 138 | + @Autowired | |
| 139 | + CarParkRepository carParkRepository; | |
| 140 | + | |
| 141 | + @Autowired | |
| 142 | + CarConfigInfoRepository carConfigInfoRepository; | |
| 143 | + | |
| 144 | + @Autowired | |
| 145 | + LineRepository lineRepository; | |
| 146 | + | |
| 147 | + @Autowired | |
| 148 | + StationRouteRepository stationRouteRepository; | |
| 149 | + | |
| 150 | + @Autowired | |
| 151 | + PersonnelRepository personnelRepository; | |
| 152 | + | |
| 153 | + @Autowired | |
| 154 | + BusinessRepository businessRepository; | |
| 155 | + | |
| 156 | + @Autowired | |
| 157 | + GeoCacheData geoCacheData; | |
| 158 | + | |
| 159 | + @Autowired | |
| 160 | + Station2ParkBuffer station2ParkBuffer; | |
| 161 | + | |
| 162 | + @Autowired | |
| 163 | + PersionPinYinBuffer persionPinYinBuffer; | |
| 164 | + | |
| 165 | + @Autowired | |
| 166 | + CalcIntervalRepository calcIntervalRepository; | |
| 167 | + | |
| 168 | + @Override | |
| 169 | + public void run() { | |
| 170 | + loadAllData(); | |
| 171 | + } | |
| 172 | + | |
| 173 | + /** | |
| 174 | + * @Title: loadAllData | |
| 175 | + * @Description: TODO(加载所有数据) | |
| 176 | + */ | |
| 177 | + public int loadAllData() { | |
| 178 | + try { | |
| 179 | + logger.info("开始加载基础数据..,"); | |
| 180 | + //设备信息 | |
| 181 | + loadDeviceInfo(); | |
| 182 | + //站点信息 | |
| 183 | + loadStationInfo(); | |
| 184 | + //线路信息 | |
| 185 | + loadLineInfo(); | |
| 186 | + //车辆和线路映射信息 | |
| 187 | + loadNbbm2LineInfo(); | |
| 188 | + loadLineCodeHistoryNbbmMapInfo(); | |
| 189 | + //人员信息 | |
| 190 | + loadPersonnelInfo(); | |
| 191 | + //公司信息 | |
| 192 | + loadBusinessInfo(); | |
| 193 | + // 线路等级信息 | |
| 194 | + loadLineLevel(); | |
| 195 | + | |
| 196 | + logger.info("load geo cache..,"); | |
| 197 | + geoCacheData.loadData(); | |
| 198 | + station2ParkBuffer.saveAll(); | |
| 199 | + logger.info("加载基础数据成功!,"); | |
| 200 | + } catch (Exception e) { | |
| 201 | + logger.error("加载基础数据时出现异常,", e); | |
| 202 | + } | |
| 203 | + return 0; | |
| 204 | + } | |
| 205 | + | |
| 206 | + /** | |
| 207 | + * loadBusinessInfo | |
| 208 | + * (公司代码公司名对照) | |
| 209 | + */ | |
| 210 | + public void loadBusinessInfo() { | |
| 211 | + Map<String, String> businessMap = new HashMap<String, String>(); | |
| 212 | + Map<String, String> businessFgsMap = new HashMap<String, String>(); | |
| 213 | + Iterator<Business> busIter = businessRepository.findAll().iterator(); | |
| 214 | + Business t; | |
| 215 | + while (busIter.hasNext()) { | |
| 216 | + t = busIter.next(); | |
| 217 | + businessMap.put(t.getBusinessCode(), t.getBusinessName()); | |
| 218 | + businessFgsMap.put(t.getBusinessCode() + "_" + t.getUpCode(), t.getBusinessName()); | |
| 219 | + } | |
| 220 | + businessCodeNameMap = businessMap; | |
| 221 | + businessFgsCodeNameMap = businessFgsMap; | |
| 222 | + } | |
| 223 | + | |
| 224 | + /** | |
| 225 | + * @Title: loadDeviceInfo | |
| 226 | + * @Description: TODO(加载设备相关信息) | |
| 227 | + */ | |
| 228 | + public void loadDeviceInfo() { | |
| 229 | + BiMap<String, String> deviceId2Nbbm = HashBiMap.create(); | |
| 230 | + //车辆和公司代码对照 | |
| 231 | + Map<String, String> nbbm2CompanyCode = new HashMap<>(); | |
| 232 | + //车辆和分公司代码对照 | |
| 233 | + Map<String, String> nbbm2FgsCompanyCode = new HashMap<>(); | |
| 234 | + | |
| 235 | + //车辆自编号和拍照号对照 | |
| 236 | + BiMap<String, String> nbbmCompanyPlate = HashBiMap.create(); | |
| 237 | + | |
| 238 | + Iterator<Cars> carIterator = carsRepository.findAll().iterator(); | |
| 239 | + Cars car; | |
| 240 | + while (carIterator.hasNext()) { | |
| 241 | + car = carIterator.next(); | |
| 242 | + deviceId2Nbbm.put(car.getEquipmentCode(), car.getInsideCode()); | |
| 243 | + nbbm2CompanyCode.put(car.getInsideCode(), car.getBusinessCode()); | |
| 244 | + nbbm2FgsCompanyCode.put(car.getInsideCode(), car.getBrancheCompanyCode() + "_" + car.getBusinessCode() ); | |
| 245 | + nbbmCompanyPlate.put(car.getInsideCode(), car.getCarPlate()); | |
| 246 | + } | |
| 247 | + | |
| 248 | + deviceId2NbbmMap = deviceId2Nbbm; | |
| 249 | + nbbm2CompanyCodeMap = nbbm2CompanyCode; | |
| 250 | + nbbm2FgsCompanyCodeMap = nbbm2FgsCompanyCode; | |
| 251 | + nbbmCompanyPlateMap =nbbmCompanyPlate; | |
| 252 | + } | |
| 253 | + | |
| 254 | + /** | |
| 255 | + * @Title: loadStationInfo | |
| 256 | + * @Description: TODO(加载站点信息) | |
| 257 | + */ | |
| 258 | + public void loadStationInfo() { | |
| 259 | + Map<String, String> stationCode2Name = new HashMap<>(); | |
| 260 | + Iterator<StationRoute> iterator = stationRouteRepository.findAll().iterator(); | |
| 261 | + StationRoute sroute; | |
| 262 | + while (iterator.hasNext()) { | |
| 263 | + sroute = iterator.next(); | |
| 264 | + stationCode2Name.put(sroute.getLineCode() + "_" + sroute.getDirections() + "_" + sroute.getStationCode(), sroute.getStationName()); | |
| 265 | + } | |
| 266 | + | |
| 267 | + //停车场 | |
| 268 | + Iterator<CarPark> iterator2 = carParkRepository.findAll().iterator(); | |
| 269 | + | |
| 270 | + List<String> parkCodes = new ArrayList<>(); | |
| 271 | + | |
| 272 | + CarPark carPark; | |
| 273 | + while (iterator2.hasNext()) { | |
| 274 | + carPark = iterator2.next(); | |
| 275 | + stationCode2Name.put(carPark.getParkCode(), carPark.getParkName()); | |
| 276 | + | |
| 277 | + parkCodes.add(carPark.getParkCode()); | |
| 278 | + } | |
| 279 | + parkCodeList = parkCodes; | |
| 280 | + stationCode2NameMap = stationCode2Name; | |
| 281 | + } | |
| 282 | + | |
| 283 | + /** | |
| 284 | + * @Title: loadNbbm2LineInfo | |
| 285 | + * @Description: TODO(车辆和线路对照) | |
| 286 | + */ | |
| 287 | + public void loadNbbm2LineInfo() { | |
| 288 | + Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 289 | + Map<String, Line> ccMap = new HashMap<>(); | |
| 290 | + | |
| 291 | + CarConfigInfo cci; | |
| 292 | + while (allIterator.hasNext()) { | |
| 293 | + cci = allIterator.next(); | |
| 294 | + if(cci.getIsCancel()) | |
| 295 | + continue;//排除已经报废的 | |
| 296 | + ccMap.put(cci.getCl().getInsideCode(), cci.getXl()); | |
| 297 | + } | |
| 298 | + nbbm2LineMap = ccMap; | |
| 299 | + } | |
| 300 | + | |
| 301 | + /** | |
| 302 | + * @Title: loadLineCodeHistoryNbbmMapInfo | |
| 303 | + * @Description: TODO(线路历史配车) | |
| 304 | + */ | |
| 305 | + public void loadLineCodeHistoryNbbmMapInfo() { | |
| 306 | + Iterator<CarConfigInfo> allIterator = carConfigInfoRepository.findAll().iterator(); | |
| 307 | + Map<String, List<String>> ccMap = new HashMap<>(); //用list保持排序 | |
| 308 | + Map<String, Set<String>> sMap = new HashMap<>(); //用Set去重 | |
| 309 | + | |
| 310 | + CarConfigInfo cci; | |
| 311 | + while (allIterator.hasNext()) { | |
| 312 | + cci = allIterator.next(); | |
| 313 | + String lineCode = cci.getXl().getLineCode(); | |
| 314 | + if(!ccMap.containsKey(lineCode)){ | |
| 315 | + ccMap.put(lineCode, new ArrayList<String>()); | |
| 316 | + sMap.put(lineCode, new HashSet<String>()); | |
| 317 | + } | |
| 318 | + if(sMap.get(lineCode).add(cci.getCl().getInsideCode())){ | |
| 319 | + ccMap.get(lineCode).add(cci.getCl().getInsideCode()); | |
| 320 | + } | |
| 321 | + } | |
| 322 | + lineCodeHistoryNbbmMap = ccMap; | |
| 323 | + } | |
| 324 | + | |
| 325 | + /** | |
| 326 | + * @Title: loadLineInfo | |
| 327 | + * @Description: TODO(加载线路相关信息) | |
| 328 | + */ | |
| 329 | + public void loadLineInfo() { | |
| 330 | + Iterator<Line> iterator = lineRepository.findAllService().iterator(); | |
| 331 | + | |
| 332 | + Line line; | |
| 333 | + BiMap<Integer, String> biMap = HashBiMap.create(); | |
| 334 | + Map<String, String> code2name = new HashMap<>(); | |
| 335 | + Map<Integer, String> id2SHcode = new HashMap<Integer, String>(); | |
| 336 | + Map<String, String> code2SHcode = new HashMap<String, String>(); | |
| 337 | + Map<String, Integer> tempStationName2YgcNumber = new HashMap<String, Integer>(); | |
| 338 | + | |
| 339 | + /** | |
| 340 | + * 加载运管处的站点及序号 | |
| 341 | + * 上行从1开始,下行顺序续编 | |
| 342 | + */ | |
| 343 | + List<Map<String, String>> ygcLines = stationRouteRepository.findAllLineWithYgc(); | |
| 344 | + if(ygcLines != null && ygcLines.size() > 0){ | |
| 345 | + int size = ygcLines.size(); | |
| 346 | + Map<String, String> tempMap ; | |
| 347 | + int num = 1; | |
| 348 | + String key; | |
| 349 | + String lineCode = ""; | |
| 350 | + for (int i = 0; i < size; i ++){ | |
| 351 | + tempMap = ygcLines.get(i); | |
| 352 | + if(lineCode.equals("")){ | |
| 353 | + lineCode = tempMap.get("lineCode"); | |
| 354 | + }else if(!lineCode.equals(tempMap.get("lineCode"))){ | |
| 355 | + num = 1; | |
| 356 | + lineCode = tempMap.get("lineCode"); | |
| 357 | + } | |
| 358 | + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions")) | |
| 359 | + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark"); | |
| 360 | + tempStationName2YgcNumber.put(key,num++); | |
| 361 | + } | |
| 362 | + } | |
| 363 | + | |
| 364 | + while (iterator.hasNext()) { | |
| 365 | + line = iterator.next(); | |
| 366 | + biMap.put(line.getId(), line.getLineCode()); | |
| 367 | + code2name.put(line.getLineCode(), line.getName()); | |
| 368 | + id2SHcode.put(line.getId(), line.getShanghaiLinecode()); | |
| 369 | + code2SHcode.put(line.getLineCode(), line.getShanghaiLinecode()); | |
| 370 | + } | |
| 371 | + | |
| 372 | + lineId2CodeMap = biMap; | |
| 373 | + lineCode2NameMap = code2name; | |
| 374 | + lineId2ShangHaiCodeMap = id2SHcode; | |
| 375 | + lineCode2ShangHaiCodeMap = code2SHcode; | |
| 376 | + stationName2YgcNumber = tempStationName2YgcNumber; | |
| 377 | + | |
| 378 | + Map<String, String> code2nameAll = new HashMap<>(); | |
| 379 | + Iterator<Line> iteratorAll = lineRepository.findAll().iterator(); | |
| 380 | + while (iteratorAll.hasNext()) { | |
| 381 | + line = iteratorAll.next(); | |
| 382 | + code2nameAll.put(line.getLineCode(), line.getName()); | |
| 383 | + } | |
| 384 | + lineCodeAllNameMap=code2nameAll; | |
| 385 | + } | |
| 386 | + | |
| 387 | + /** | |
| 388 | + * @Title: loadPersonnelInfo | |
| 389 | + * @Description: TODO(加载人员信息) | |
| 390 | + */ | |
| 391 | + public void loadPersonnelInfo() { | |
| 392 | + Iterator<Personnel> iterator = personnelRepository.findAll().iterator(); | |
| 393 | + | |
| 394 | + Map<String, Personnel> /*jsyTempMap = new HashMap<>(), spyTempMap = new HashMap<>(),*/perTempMap=new HashMap<>(); | |
| 395 | + Map<String, String> allPersonMap = new HashMap<>(); | |
| 396 | + | |
| 397 | + Personnel p; | |
| 398 | + String jobCode; | |
| 399 | + while (iterator.hasNext()) { | |
| 400 | + p = iterator.next(); | |
| 401 | + | |
| 402 | + jobCode = p.getJobCode(); | |
| 403 | + if (StringUtils.isEmpty(jobCode)) | |
| 404 | + continue; | |
| 405 | + | |
| 406 | + /*if (p.getPosts() != null) { | |
| 407 | + if (p.getPosts().equals("1")) | |
| 408 | + jsyTempMap.put(jobCode, p); | |
| 409 | + else if (p.getPosts().equals("2")) | |
| 410 | + spyTempMap.put(jobCode, p); | |
| 411 | + }*/ | |
| 412 | + | |
| 413 | + perTempMap.put(jobCode, p); | |
| 414 | + | |
| 415 | + allPersonMap.put(jobCode, p.getPersonnelName()); | |
| 416 | + } | |
| 417 | + | |
| 418 | + //jsyMap = jsyTempMap; | |
| 419 | + //spyMap = spyTempMap; | |
| 420 | + allPerson = allPersonMap; | |
| 421 | + perMap = perTempMap; | |
| 422 | + | |
| 423 | + //人员拼音转换 | |
| 424 | + persionPinYinBuffer.refresh(); | |
| 425 | + } | |
| 426 | + | |
| 427 | + /** | |
| 428 | + * 加载线路级别信息 按当前日期取(当前+前后一天)的数据 | |
| 429 | + */ | |
| 430 | + public void loadLineLevel() { | |
| 431 | + List<String> dates = new ArrayList<>(); | |
| 432 | + Map<String, String> result = new HashMap<>(); | |
| 433 | + DateFormat df = new SimpleDateFormat("yyyy-MM-dd"); | |
| 434 | + | |
| 435 | + Calendar c = Calendar.getInstance(); | |
| 436 | + c.setTime(new Date(System.currentTimeMillis() - 86400000)); | |
| 437 | + dates.add(df.format(c.getTime())); | |
| 438 | + | |
| 439 | + for (int i = 0;i < 2;i++) { | |
| 440 | + c.add(Calendar.DATE, 1); | |
| 441 | + dates.add(df.format(c.getTime())); | |
| 442 | + } | |
| 443 | + | |
| 444 | + List<CalcInterval> l = calcIntervalRepository.selectByDates(dates); | |
| 445 | + for (CalcInterval ci : l) { | |
| 446 | + result.put(ci.getXlBm() + "_" + ci.getDate(), ci.getLevel()); | |
| 447 | + } | |
| 448 | + | |
| 449 | + lineDate2Level = result; | |
| 450 | + } | |
| 451 | + } | |
| 452 | +} | ... | ... |