Commit 9a3f0ed5c546695890e782358eb8504450181f71
Merge branch 'minhang' into pudong
Showing
13 changed files
with
656 additions
and
140 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| ... | ... | @@ -24,10 +24,10 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 24 | 24 | |
| 25 | 25 | /*@Autowired |
| 26 | 26 | GetSchedulePlanThread getSchedulePlanThread;*/ |
| 27 | - | |
| 27 | + | |
| 28 | 28 | @Autowired |
| 29 | 29 | ScheduleRealInfoService scheduleRealInfoService; |
| 30 | - | |
| 30 | + | |
| 31 | 31 | @Autowired |
| 32 | 32 | DayOfSchedule dayOfSchedule; |
| 33 | 33 | |
| ... | ... | @@ -42,29 +42,29 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | - * | |
| 45 | + * | |
| 46 | 46 | * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id |
| 47 | 47 | * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws |
| 48 | 48 | */ |
| 49 | 49 | @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) |
| 50 | 50 | public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, |
| 51 | - @RequestParam String dfsj,String bcType) { | |
| 51 | + @RequestParam String dfsj,String bcType) { | |
| 52 | 52 | return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | /** |
| 56 | - * | |
| 56 | + * | |
| 57 | 57 | * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔 |
| 58 | 58 | */ |
| 59 | 59 | @RequestMapping(value = "/destroy", method = RequestMethod.POST) |
| 60 | 60 | public Map<String, Object> destroy(@RequestParam String idsStr |
| 61 | 61 | /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, |
| 62 | - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { | |
| 62 | + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { | |
| 63 | 63 | return scheduleRealInfoService.destroy(idsStr/*, spaceAdjust*/, remarks, adjustExps/*, spaceNum*/); |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | - * | |
| 67 | + * | |
| 68 | 68 | * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws |
| 69 | 69 | */ |
| 70 | 70 | @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET) |
| ... | ... | @@ -73,7 +73,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | /** |
| 76 | - * | |
| 76 | + * | |
| 77 | 77 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param |
| 78 | 78 | * lineId @throws |
| 79 | 79 | */ |
| ... | ... | @@ -83,7 +83,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | /** |
| 86 | - * | |
| 86 | + * | |
| 87 | 87 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param |
| 88 | 88 | * lineId @throws |
| 89 | 89 | */ |
| ... | ... | @@ -93,7 +93,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | /** |
| 96 | - * | |
| 96 | + * | |
| 97 | 97 | * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param |
| 98 | 98 | * lineId @throws |
| 99 | 99 | */ |
| ... | ... | @@ -103,7 +103,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
| 106 | - * | |
| 106 | + * | |
| 107 | 107 | * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws |
| 108 | 108 | */ |
| 109 | 109 | @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET) |
| ... | ... | @@ -111,9 +111,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 111 | 111 | return scheduleRealInfoService.sreachVehic(nbbm); |
| 112 | 112 | } |
| 113 | 113 | /** |
| 114 | - * | |
| 115 | - * @Title: realOutAdjust | |
| 116 | - * @Description: TODO(实发调整) | |
| 114 | + * | |
| 115 | + * @Title: realOutAdjust | |
| 116 | + * @Description: TODO(实发调整) | |
| 117 | 117 | * @param @param id 班次ID |
| 118 | 118 | * @param @param fcsjActual 实际发车时间 HH:mm |
| 119 | 119 | * @param @param remarks 备注 |
| ... | ... | @@ -121,14 +121,14 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 121 | 121 | */ |
| 122 | 122 | @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) |
| 123 | 123 | public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual, |
| 124 | - @RequestParam String remarks) { | |
| 124 | + @RequestParam String remarks) { | |
| 125 | 125 | return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); |
| 126 | 126 | } |
| 127 | - | |
| 127 | + | |
| 128 | 128 | /** |
| 129 | - * | |
| 130 | - * @Title: revokeDestroy | |
| 131 | - * @Description: TODO(撤销烂班) | |
| 129 | + * | |
| 130 | + * @Title: revokeDestroy | |
| 131 | + * @Description: TODO(撤销烂班) | |
| 132 | 132 | * @param @param id |
| 133 | 133 | * @throws |
| 134 | 134 | */ |
| ... | ... | @@ -136,11 +136,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 136 | 136 | public Map<String, Object> revokeDestroy(@RequestParam Long id){ |
| 137 | 137 | return scheduleRealInfoService.revokeDestroy(id); |
| 138 | 138 | } |
| 139 | - | |
| 139 | + | |
| 140 | 140 | /** |
| 141 | - * | |
| 142 | - * @Title: revokeRealOutgo | |
| 143 | - * @Description: TODO(撤销实发) | |
| 141 | + * | |
| 142 | + * @Title: revokeRealOutgo | |
| 143 | + * @Description: TODO(撤销实发) | |
| 144 | 144 | * @param @param id |
| 145 | 145 | * @throws |
| 146 | 146 | */ |
| ... | ... | @@ -160,9 +160,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | /** |
| 163 | - * | |
| 164 | - * @Title: spaceAdjust | |
| 165 | - * @Description: TODO(间隔调整) | |
| 163 | + * | |
| 164 | + * @Title: spaceAdjust | |
| 165 | + * @Description: TODO(间隔调整) | |
| 166 | 166 | * @param @param ids 要调整的班次数组ID |
| 167 | 167 | * @param @param space 间隔 |
| 168 | 168 | * @throws |
| ... | ... | @@ -171,11 +171,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 171 | 171 | public Map<String, Object> spaceAdjust(Long[] ids, Integer space){ |
| 172 | 172 | return scheduleRealInfoService.spaceAdjust(ids, space); |
| 173 | 173 | } |
| 174 | - | |
| 174 | + | |
| 175 | 175 | /** |
| 176 | - * | |
| 177 | - * @Title: schInfoFineTune | |
| 178 | - * @Description: TODO(发车信息微调) | |
| 176 | + * | |
| 177 | + * @Title: schInfoFineTune | |
| 178 | + * @Description: TODO(发车信息微调) | |
| 179 | 179 | * @param @param map |
| 180 | 180 | * @throws |
| 181 | 181 | */ |
| ... | ... | @@ -183,11 +183,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 183 | 183 | public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){ |
| 184 | 184 | return scheduleRealInfoService.schInfoFineTune(map); |
| 185 | 185 | } |
| 186 | - | |
| 186 | + | |
| 187 | 187 | /** |
| 188 | - * | |
| 189 | - * @Title: outgoAdjustAll | |
| 190 | - * @Description: TODO(批量待发调整) | |
| 188 | + * | |
| 189 | + * @Title: outgoAdjustAll | |
| 190 | + * @Description: TODO(批量待发调整) | |
| 191 | 191 | * @param @param list |
| 192 | 192 | * @throws |
| 193 | 193 | */ |
| ... | ... | @@ -197,11 +197,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 197 | 197 | params = StringEscapeUtils.unescapeHtml4(params); |
| 198 | 198 | return scheduleRealInfoService.outgoAdjustAll(params); |
| 199 | 199 | } |
| 200 | - | |
| 200 | + | |
| 201 | 201 | /** |
| 202 | - * | |
| 203 | - * @Title: findByLineAndUpDown | |
| 204 | - * @Description: TODO(根据线路和走向获取班次) | |
| 202 | + * | |
| 203 | + * @Title: findByLineAndUpDown | |
| 204 | + * @Description: TODO(根据线路和走向获取班次) | |
| 205 | 205 | * @param @param line |
| 206 | 206 | * @param @param upDown |
| 207 | 207 | */ |
| ... | ... | @@ -209,11 +209,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 209 | 209 | public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){ |
| 210 | 210 | return dayOfSchedule.findByLineAndUpDown(line, upDown); |
| 211 | 211 | } |
| 212 | - | |
| 212 | + | |
| 213 | 213 | /** |
| 214 | - * | |
| 215 | - * @Title: findRouteByLine | |
| 216 | - * @Description: TODO(获取线路的站点,路段路由) | |
| 214 | + * | |
| 215 | + * @Title: findRouteByLine | |
| 216 | + * @Description: TODO(获取线路的站点,路段路由) | |
| 217 | 217 | * @param @param lineCode |
| 218 | 218 | * @throws |
| 219 | 219 | */ |
| ... | ... | @@ -221,11 +221,11 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 221 | 221 | public Map<String, Object> findRouteByLine(@RequestParam String lineCode){ |
| 222 | 222 | return scheduleRealInfoService.findRouteByLine(lineCode); |
| 223 | 223 | } |
| 224 | - | |
| 224 | + | |
| 225 | 225 | /** |
| 226 | - * | |
| 227 | - * @Title: removeChildTask | |
| 228 | - * @Description: TODO(删除子任务) | |
| 226 | + * | |
| 227 | + * @Title: removeChildTask | |
| 228 | + * @Description: TODO(删除子任务) | |
| 229 | 229 | * @param @param taskId 子任务ID |
| 230 | 230 | * @throws |
| 231 | 231 | */ |
| ... | ... | @@ -235,9 +235,9 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | /** |
| 238 | - * | |
| 239 | - * @Title: findByLineCode | |
| 240 | - * @Description: TODO(根据线路获取班次信息) | |
| 238 | + * | |
| 239 | + * @Title: findByLineCode | |
| 240 | + * @Description: TODO(根据线路获取班次信息) | |
| 241 | 241 | * @param @param lineCode |
| 242 | 242 | */ |
| 243 | 243 | @RequestMapping(value = "/lineCode/{lineCode}") |
| ... | ... | @@ -247,29 +247,29 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 247 | 247 | |
| 248 | 248 | @RequestMapping(value = "/queryUserInfo") |
| 249 | 249 | public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, |
| 250 | - @RequestParam String date,@RequestParam String state) { | |
| 250 | + @RequestParam String date,@RequestParam String state) { | |
| 251 | 251 | return scheduleRealInfoService.queryUserInfo(line, date,state); |
| 252 | 252 | } |
| 253 | - | |
| 253 | + | |
| 254 | 254 | @RequestMapping(value = "/queryUserInfoPx") |
| 255 | 255 | public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line, |
| 256 | - @RequestParam String date,@RequestParam String state,@RequestParam String type) { | |
| 256 | + @RequestParam String date,@RequestParam String state,@RequestParam String type) { | |
| 257 | 257 | return scheduleRealInfoService.queryUserInfoPx(line, date,state,type); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET) |
| 261 | 261 | public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName, @RequestParam String clZbh, |
| 262 | - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { | |
| 262 | + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { | |
| 263 | 263 | return scheduleRealInfoService.exportWaybill(jName, clZbh, lpName,date,line); |
| 264 | 264 | } |
| 265 | - | |
| 265 | + | |
| 266 | 266 | @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET) |
| 267 | 267 | public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh |
| 268 | 268 | ,@RequestParam String date,@RequestParam String line) { |
| 269 | 269 | return scheduleRealInfoService.exportWaybillQp( clZbh, date,line); |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - | |
| 272 | + | |
| 273 | 273 | @RequestMapping(value = "/dailyInfo") |
| 274 | 274 | public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) { |
| 275 | 275 | return scheduleRealInfoService.dailyInfo(line, date, type); |
| ... | ... | @@ -277,41 +277,41 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 277 | 277 | |
| 278 | 278 | @RequestMapping(value = "/historyMessage") |
| 279 | 279 | public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date, |
| 280 | - @RequestParam String code, @RequestParam String type) { | |
| 280 | + @RequestParam String code, @RequestParam String type) { | |
| 281 | 281 | return scheduleRealInfoService.historyMessage(line, date, code, type); |
| 282 | 282 | } |
| 283 | - | |
| 283 | + | |
| 284 | 284 | @RequestMapping(value="/findLine") |
| 285 | 285 | public List<Map<String,String>> findLine(@RequestParam String line){ |
| 286 | 286 | return scheduleRealInfoService.findLine(line); |
| 287 | 287 | } |
| 288 | - | |
| 288 | + | |
| 289 | 289 | @RequestMapping(value="/findKMBC",method = RequestMethod.GET) |
| 290 | 290 | public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName |
| 291 | 291 | ,@RequestParam String date,@RequestParam String line){ |
| 292 | 292 | return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line); |
| 293 | 293 | } |
| 294 | - | |
| 294 | + | |
| 295 | 295 | @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET) |
| 296 | 296 | public Map<String,Object> findKMBCQp(@RequestParam String clZbh |
| 297 | 297 | ,@RequestParam String date,@RequestParam String line){ |
| 298 | 298 | return scheduleRealInfoService.findKMBCQp(clZbh,date,line); |
| 299 | 299 | } |
| 300 | - | |
| 300 | + | |
| 301 | 301 | @RequestMapping(value="/findLpName") |
| 302 | 302 | public List<Map<String,String>> findLpName(@RequestParam String lpName){ |
| 303 | 303 | return scheduleRealInfoService.findLpName(lpName); |
| 304 | 304 | } |
| 305 | - | |
| 305 | + | |
| 306 | 306 | @RequestMapping(value = "/account") |
| 307 | 307 | public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date, |
| 308 | - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { | |
| 308 | + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { | |
| 309 | 309 | return scheduleRealInfoService.account(line, date, code, xlName, type); |
| 310 | 310 | } |
| 311 | - | |
| 311 | + | |
| 312 | 312 | @RequestMapping(value = "/correctForm") |
| 313 | 313 | public List<ScheduleRealInfo> correctForm(@RequestParam String line, @RequestParam String startDate, |
| 314 | - @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) { | |
| 314 | + @RequestParam String endDate, @RequestParam String lpName, @RequestParam String code, @RequestParam String type) { | |
| 315 | 315 | return scheduleRealInfoService.correctForm(line, startDate, endDate, lpName, code, type); |
| 316 | 316 | } |
| 317 | 317 | /** |
| ... | ... | @@ -327,19 +327,19 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 327 | 327 | ,@RequestParam String date,@RequestParam String line){ |
| 328 | 328 | return scheduleRealInfoService.queryListWaybill(jName, clZbh,lpName,date,line); |
| 329 | 329 | } |
| 330 | - | |
| 330 | + | |
| 331 | 331 | @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET) |
| 332 | 332 | public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh, |
| 333 | - @RequestParam String date,@RequestParam String line){ | |
| 333 | + @RequestParam String date,@RequestParam String line){ | |
| 334 | 334 | return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line); |
| 335 | 335 | } |
| 336 | - | |
| 336 | + | |
| 337 | 337 | @RequestMapping(value="/statisticsDaily") |
| 338 | 338 | public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date, |
| 339 | - @RequestParam String xlName, @RequestParam String type){ | |
| 339 | + @RequestParam String xlName, @RequestParam String type){ | |
| 340 | 340 | return scheduleRealInfoService.statisticsDaily(line, date, xlName, type); |
| 341 | 341 | } |
| 342 | - | |
| 342 | + | |
| 343 | 343 | @RequestMapping(value="/statisticsDailyTj") |
| 344 | 344 | public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ |
| 345 | 345 | String gsdm=""; |
| ... | ... | @@ -372,41 +372,41 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 372 | 372 | } |
| 373 | 373 | return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type); |
| 374 | 374 | } |
| 375 | - | |
| 375 | + | |
| 376 | 376 | @RequestMapping(value="/MapById",method = RequestMethod.GET) |
| 377 | 377 | public Map<String, Object> MapById(@RequestParam("id") Long id){ |
| 378 | 378 | return scheduleRealInfoService.MapById(id); |
| 379 | 379 | } |
| 380 | - | |
| 380 | + | |
| 381 | 381 | /** |
| 382 | - * @Title: scheduleDaily | |
| 383 | - * @Description: TODO(调度日报表) | |
| 382 | + * @Title: scheduleDaily | |
| 383 | + * @Description: TODO(调度日报表) | |
| 384 | 384 | * @param line 线路 |
| 385 | 385 | * @param date 时间 |
| 386 | - * @return | |
| 386 | + * @return | |
| 387 | 387 | */ |
| 388 | 388 | @RequestMapping(value="/scheduleDaily") |
| 389 | 389 | public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){ |
| 390 | 390 | return scheduleRealInfoService.scheduleDaily(line,date); |
| 391 | 391 | } |
| 392 | - | |
| 392 | + | |
| 393 | 393 | @RequestMapping(value="/realScheduleList") |
| 394 | 394 | public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){ |
| 395 | 395 | return scheduleRealInfoService.realScheduleList(line,date); |
| 396 | 396 | } |
| 397 | - | |
| 397 | + | |
| 398 | 398 | @RequestMapping(value="/realScheduleListQp") |
| 399 | 399 | public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){ |
| 400 | 400 | return scheduleRealInfoService.realScheduleListQp(line,date); |
| 401 | 401 | } |
| 402 | - | |
| 402 | + | |
| 403 | 403 | @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST) |
| 404 | 404 | public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ |
| 405 | 405 | cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); |
| 406 | 406 | List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); |
| 407 | 407 | return scheduleRealInfoService.multi_tzrc(cpcs); |
| 408 | 408 | } |
| 409 | - | |
| 409 | + | |
| 410 | 410 | @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) |
| 411 | 411 | public Map<String, Object> multi_dftz(@RequestParam String dcsJson){ |
| 412 | 412 | dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson); |
| ... | ... | @@ -436,7 +436,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 436 | 436 | List<String> rs = new ArrayList<>(); |
| 437 | 437 | |
| 438 | 438 | long t = new Date().getTime() - ONE_DAY - (1000 * 60 * 60 * 2); |
| 439 | - for(int i = 0; i < 5; i ++){ | |
| 439 | + for(int i = 0; i < 10; i ++){ | |
| 440 | 440 | rs.add(fmtyyyyMMdd.print(t)); |
| 441 | 441 | t -= ONE_DAY; |
| 442 | 442 | } |
| ... | ... | @@ -467,7 +467,7 @@ public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, |
| 467 | 467 | public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){ |
| 468 | 468 | return scheduleRealInfoService.scheduleDailyExport(map); |
| 469 | 469 | } |
| 470 | - | |
| 470 | + | |
| 471 | 471 | @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) |
| 472 | 472 | public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ |
| 473 | 473 | return scheduleRealInfoService.exportWaybillMore(map); | ... | ... |
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
| 1 | 1 | package com.bsth.controller.realcontrol; |
| 2 | 2 | |
| 3 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 3 | 4 | import com.bsth.data.schedule.DayOfSchedule; |
| 4 | 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 5 | 6 | import org.slf4j.Logger; |
| ... | ... | @@ -49,4 +50,9 @@ public class anomalyCheckController { |
| 49 | 50 | dayOfSchedule.replaceByNbbm(nbbm, map.values()); |
| 50 | 51 | } |
| 51 | 52 | } |
| 53 | + | |
| 54 | + @RequestMapping(value = "/shutdownThreadPool") | |
| 55 | + public void shutdownThreadPool(){ | |
| 56 | + GpsRealAnalyse.shutdown(); | |
| 57 | + } | |
| 52 | 58 | } | ... | ... |
src/main/java/com/bsth/data/directive/GatewayHttpUtils.java
| 1 | 1 | package com.bsth.data.directive; |
| 2 | 2 | |
| 3 | -import java.io.IOException; | |
| 4 | - | |
| 3 | +import com.alibaba.fastjson.JSONObject; | |
| 4 | +import com.bsth.util.ConfigUtil; | |
| 5 | 5 | import org.apache.http.client.config.RequestConfig; |
| 6 | 6 | import org.apache.http.client.methods.CloseableHttpResponse; |
| 7 | 7 | import org.apache.http.client.methods.HttpPost; |
| ... | ... | @@ -12,8 +12,7 @@ import org.apache.http.util.EntityUtils; |
| 12 | 12 | import org.slf4j.Logger; |
| 13 | 13 | import org.slf4j.LoggerFactory; |
| 14 | 14 | |
| 15 | -import com.alibaba.fastjson.JSONObject; | |
| 16 | -import com.bsth.util.ConfigUtil; | |
| 15 | +import java.io.IOException; | |
| 17 | 16 | |
| 18 | 17 | /** |
| 19 | 18 | * |
| ... | ... | @@ -42,7 +41,7 @@ public class GatewayHttpUtils { |
| 42 | 41 | |
| 43 | 42 | //超时时间 |
| 44 | 43 | RequestConfig requestConfig = RequestConfig.custom() |
| 45 | - .setConnectTimeout(3000).setConnectionRequestTimeout(1000) | |
| 44 | + .setConnectTimeout(3000).setConnectionRequestTimeout(1000) | |
| 46 | 45 | .setSocketTimeout(3000).build(); |
| 47 | 46 | |
| 48 | 47 | HttpPost post = new HttpPost(url); | ... | ... |
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
| ... | ... | @@ -4,6 +4,7 @@ import com.bsth.data.BasicData; |
| 4 | 4 | import com.bsth.data.forecast.ForecastRealServer; |
| 5 | 5 | import com.bsth.data.gpsdata.thread.GpsDataLoaderThread; |
| 6 | 6 | import com.bsth.data.gpsdata.thread.OfflineMonitorThread; |
| 7 | +import com.bsth.data.gpsdata.thread.ThreadPollMonitor; | |
| 7 | 8 | import com.bsth.data.schedule.DayOfSchedule; |
| 8 | 9 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 9 | 10 | import com.google.common.collect.TreeMultimap; |
| ... | ... | @@ -46,6 +47,9 @@ public class GpsRealData implements CommandLineRunner { |
| 46 | 47 | @Autowired |
| 47 | 48 | ForecastRealServer forecastRealServer; |
| 48 | 49 | |
| 50 | + @Autowired | |
| 51 | + ThreadPollMonitor threadPollMonitor; | |
| 52 | + | |
| 49 | 53 | /** |
| 50 | 54 | * 构造函数 |
| 51 | 55 | */ |
| ... | ... | @@ -61,6 +65,10 @@ public class GpsRealData implements CommandLineRunner { |
| 61 | 65 | //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 2, TimeUnit.SECONDS); |
| 62 | 66 | //定时扫描掉离线 |
| 63 | 67 | //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); |
| 68 | + | |
| 69 | + //扫描GPS线程池状态 | |
| 70 | + //Application.mainServices.scheduleWithFixedDelay(threadPollMonitor, 60, 20, TimeUnit.SECONDS); | |
| 71 | + | |
| 64 | 72 | } |
| 65 | 73 | |
| 66 | 74 | ... | ... |
src/main/java/com/bsth/data/gpsdata/arrival/GpsRealAnalyse.java
| ... | ... | @@ -26,7 +26,7 @@ import java.util.concurrent.Executors; |
| 26 | 26 | @Component |
| 27 | 27 | public class GpsRealAnalyse { |
| 28 | 28 | |
| 29 | - Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 29 | + static Logger logger = LoggerFactory.getLogger(GpsRealAnalyse.class); | |
| 30 | 30 | |
| 31 | 31 | @Autowired |
| 32 | 32 | OfflineSignalHandle offlineSignalHandle; |
| ... | ... | @@ -46,40 +46,54 @@ public class GpsRealAnalyse { |
| 46 | 46 | |
| 47 | 47 | static ExecutorService threadPool = Executors.newFixedThreadPool(100); |
| 48 | 48 | |
| 49 | + public static long st; | |
| 50 | + public static CountDownLatch count; | |
| 51 | + | |
| 49 | 52 | public void analyse(List<GpsEntity> list) { |
| 50 | - //如果正在恢复数据 | |
| 51 | - if (GpsDataRecovery.run) | |
| 52 | - return; | |
| 53 | - | |
| 54 | - long t = System.currentTimeMillis(); | |
| 55 | - logger.info("analyse gps size: " + list.size()); | |
| 56 | - //按线路分组gps | |
| 57 | - ArrayListMultimap multimap = ArrayListMultimap.create(); | |
| 58 | - for(GpsEntity gps : list){ | |
| 59 | - multimap.put(gps.getLineId(), gps); | |
| 60 | - } | |
| 53 | + try { | |
| 54 | + st = System.currentTimeMillis(); | |
| 55 | + //如果正在恢复数据 | |
| 56 | + if (GpsDataRecovery.run) | |
| 57 | + return; | |
| 58 | + | |
| 59 | + //按线路分组gps | |
| 60 | + ArrayListMultimap multimap = ArrayListMultimap.create(); | |
| 61 | + for (GpsEntity gps : list) { | |
| 62 | + multimap.put(gps.getLineId(), gps); | |
| 63 | + } | |
| 61 | 64 | |
| 62 | - Set<String> ks = multimap.keySet(); | |
| 63 | - CountDownLatch count = new CountDownLatch(ks.size()); | |
| 65 | + Set<String> ks = multimap.keySet(); | |
| 66 | + logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); | |
| 67 | + count = new CountDownLatch(ks.size()); | |
| 64 | 68 | |
| 65 | - for(String lineCode : ks){ | |
| 66 | - threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count)); | |
| 67 | - } | |
| 69 | + for (String lineCode : ks) { | |
| 70 | + threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count)); | |
| 71 | + } | |
| 68 | 72 | |
| 69 | - try { | |
| 70 | 73 | //等待子线程结束 |
| 71 | 74 | count.await(); |
| 72 | 75 | |
| 73 | 76 | //加入实时gps对照 |
| 74 | - for(GpsEntity gps: list) | |
| 77 | + for (GpsEntity gps : list) | |
| 75 | 78 | gpsRealData.put(gps); |
| 76 | 79 | |
| 77 | - logger.info("time , " + (System.currentTimeMillis() - t)); | |
| 78 | - } catch (InterruptedException e) { | |
| 80 | + logger.info("time , " + (System.currentTimeMillis() - st)); | |
| 81 | + } catch (Exception e) { | |
| 79 | 82 | logger.error("", e); |
| 80 | 83 | } |
| 81 | 84 | } |
| 82 | 85 | |
| 86 | + public static void shutdown() { | |
| 87 | + logger.warn("GpsRealAnalyse shutdown!!"); | |
| 88 | + threadPool.shutdownNow(); | |
| 89 | + long len = count.getCount(); | |
| 90 | + for (int i = 0; i < len; i++) { | |
| 91 | + count.countDown(); | |
| 92 | + } | |
| 93 | + | |
| 94 | + threadPool = Executors.newFixedThreadPool(100); | |
| 95 | + } | |
| 96 | + | |
| 83 | 97 | static GpsComp comp = new GpsComp(); |
| 84 | 98 | |
| 85 | 99 | public class SignalHandleThread implements Runnable { |
| ... | ... | @@ -97,7 +111,7 @@ public class GpsRealAnalyse { |
| 97 | 111 | |
| 98 | 112 | try { |
| 99 | 113 | Collections.sort(list, comp); |
| 100 | - for(GpsEntity gps : list){ | |
| 114 | + for (GpsEntity gps : list) { | |
| 101 | 115 | //是否有任务 |
| 102 | 116 | boolean task; |
| 103 | 117 | CircleQueue<GpsEntity> prevs = GeoCacheData.getGps(gps.getNbbm()); |
| ... | ... | @@ -110,7 +124,7 @@ public class GpsRealAnalyse { |
| 110 | 124 | //异常判定(越界/超速) |
| 111 | 125 | abnormalStateHandle.handle(gps, prevs); |
| 112 | 126 | |
| 113 | - if(!task) | |
| 127 | + if (!task) | |
| 114 | 128 | return; //无任务的,到这里就结束 |
| 115 | 129 | |
| 116 | 130 | //反向处理 |
| ... | ... | @@ -122,7 +136,7 @@ public class GpsRealAnalyse { |
| 122 | 136 | } catch (Exception e) { |
| 123 | 137 | logger.error("", e); |
| 124 | 138 | } finally { |
| 125 | - if(count != null) | |
| 139 | + if (count != null) | |
| 126 | 140 | count.countDown(); |
| 127 | 141 | } |
| 128 | 142 | } | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/GpsDataLoaderThread.java
| ... | ... | @@ -101,9 +101,9 @@ public class GpsDataLoaderThread extends Thread { |
| 101 | 101 | |
| 102 | 102 | old = gpsRealData.get(gps.getDeviceId()); |
| 103 | 103 | if (old != null && |
| 104 | - old.getTimestamp() == gps.getTimestamp() && | |
| 105 | - old.getLat() == gps.getLat() && | |
| 106 | - old.getLon() == gps.getLon()) | |
| 104 | + old.getTimestamp().equals(gps.getTimestamp()) && | |
| 105 | + old.getLat().equals(gps.getLat()) && | |
| 106 | + old.getLon().equals(gps.getLon())) | |
| 107 | 107 | continue; |
| 108 | 108 | |
| 109 | 109 | nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | ... | ... |
src/main/java/com/bsth/data/gpsdata/thread/ThreadPollMonitor.java
0 → 100644
| 1 | +package com.bsth.data.gpsdata.thread; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 4 | +import org.springframework.stereotype.Component; | |
| 5 | + | |
| 6 | +/** | |
| 7 | + * 线程池监听 | |
| 8 | + * Created by panzhao on 2017/5/10. | |
| 9 | + */ | |
| 10 | +@Component | |
| 11 | +public class ThreadPollMonitor extends Thread{ | |
| 12 | + | |
| 13 | + @Override | |
| 14 | + public void run() { | |
| 15 | + long t = System.currentTimeMillis(); | |
| 16 | + | |
| 17 | + if(t - GpsRealAnalyse.st > 3000 * 10){ | |
| 18 | + GpsRealAnalyse.shutdown(); | |
| 19 | + } | |
| 20 | + } | |
| 21 | +} | ... | ... |
src/main/java/com/bsth/data/pilot80/PilotReport.java
| ... | ... | @@ -74,7 +74,7 @@ public class PilotReport { |
| 74 | 74 | switch (d80.getData().getRequestCode()) { |
| 75 | 75 | case 0xA3: |
| 76 | 76 | //出场请求 |
| 77 | - ScheduleRealInfo outSch = dayOfSchedule.nextByBcType(nbbm, "out"); | |
| 77 | + ScheduleRealInfo outSch = dayOfSchedule.searchNearByBcType(nbbm, "out"); | |
| 78 | 78 | //如果有对应出场班次 |
| 79 | 79 | if(outSch != null){ |
| 80 | 80 | //没有计划里程的出场班次,出场既是首发站,发送下一班次的营运指令 | ... | ... |
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
| ... | ... | @@ -833,6 +833,29 @@ public class DayOfSchedule implements CommandLineRunner { |
| 833 | 833 | return sch; |
| 834 | 834 | } |
| 835 | 835 | |
| 836 | + /** | |
| 837 | + * 搜索离当前时间最近的一个指定类型的班次 | |
| 838 | + * @param nbbm | |
| 839 | + * @param bcType | |
| 840 | + * @return | |
| 841 | + */ | |
| 842 | + public ScheduleRealInfo searchNearByBcType(String nbbm, String bcType){ | |
| 843 | + List<ScheduleRealInfo> list = findByBcType(nbbm, bcType); | |
| 844 | + Collections.sort(list, schFCSJComparator); | |
| 845 | + | |
| 846 | + long t = System.currentTimeMillis(); | |
| 847 | + int distance=-1; | |
| 848 | + | |
| 849 | + ScheduleRealInfo sch = null; | |
| 850 | + for(ScheduleRealInfo temp : list){ | |
| 851 | + | |
| 852 | + if(Math.abs(temp.getDfsjT() - t) < distance || distance == -1){ | |
| 853 | + sch = temp; | |
| 854 | + } | |
| 855 | + } | |
| 856 | + return sch; | |
| 857 | + } | |
| 858 | + | |
| 836 | 859 | public List<ScheduleRealInfo> findByBcType(String nbbm, String bcType) { |
| 837 | 860 | List<ScheduleRealInfo> all = nbbmScheduleMap.get(nbbm), outList = new ArrayList<>(); |
| 838 | 861 | ... | ... |
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
| 1 | 1 | package com.bsth.data.schedule; |
| 2 | 2 | |
| 3 | -import java.util.Comparator; | |
| 4 | - | |
| 5 | 3 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | 4 | |
| 5 | +import java.util.Comparator; | |
| 6 | + | |
| 7 | 7 | /** |
| 8 | 8 | * |
| 9 | 9 | * @ClassName: ScheduleComparator |
| ... | ... | @@ -25,7 +25,7 @@ public class ScheduleComparator { |
| 25 | 25 | |
| 26 | 26 | @Override |
| 27 | 27 | public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) { |
| 28 | - return (int) (s1.getDfsjT() - s2.getDfsjT()); | |
| 28 | + return (int) (s1.getFcsjT() - s2.getFcsjT()); | |
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } | ... | ... |
src/main/java/com/bsth/service/schedule/PeopleCarPlanServiceImpl.java
| ... | ... | @@ -5,6 +5,7 @@ import java.net.URLEncoder; |
| 5 | 5 | import java.sql.ResultSet; |
| 6 | 6 | import java.sql.SQLException; |
| 7 | 7 | import java.text.DecimalFormat; |
| 8 | +import java.text.NumberFormat; | |
| 8 | 9 | import java.text.ParseException; |
| 9 | 10 | import java.text.SimpleDateFormat; |
| 10 | 11 | import java.util.ArrayList; |
| ... | ... | @@ -17,7 +18,6 @@ import java.util.List; |
| 17 | 18 | import java.util.Map; |
| 18 | 19 | import java.util.Set; |
| 19 | 20 | |
| 20 | -import org.drools.compiler.lang.DRL5Expressions.type_return; | |
| 21 | 21 | import org.springframework.beans.factory.annotation.Autowired; |
| 22 | 22 | import org.springframework.jdbc.core.JdbcTemplate; |
| 23 | 23 | import org.springframework.jdbc.core.RowMapper; |
| ... | ... | @@ -759,6 +759,254 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 759 | 759 | |
| 760 | 760 | return modelMap; |
| 761 | 761 | } |
| 762 | + | |
| 763 | + @Override | |
| 764 | + public Map<String, Object> scheduleAnaly_sum(Map<String, Object> map) { | |
| 765 | + DecimalFormat df = new DecimalFormat("00"); | |
| 766 | + NumberFormat nf = NumberFormat.getNumberInstance(); | |
| 767 | + nf.setMaximumFractionDigits(2); | |
| 768 | +// List<TTInfoDetail> ttList = new ArrayList<TTInfoDetail>(); | |
| 769 | + List<Long> ttList = new ArrayList<Long>(); | |
| 770 | + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>(); | |
| 771 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 772 | + List<Map<String, Object>> tempList = new ArrayList<Map<String, Object>>(); | |
| 773 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | |
| 774 | + Map<String, Object> modelMap = new HashMap<String, Object>(); | |
| 775 | + | |
| 776 | + String company = ""; | |
| 777 | + if(map.get("company")!=null) | |
| 778 | + company=map.get("company").toString(); | |
| 779 | + String subCompany = ""; | |
| 780 | + if(map.get("subCompany")!=null) | |
| 781 | + subCompany=map.get("subCompany").toString(); | |
| 782 | + String page = map.get("page").toString(); | |
| 783 | + String line = map.get("line").toString(); | |
| 784 | + String startDate = map.get("startDate").toString(); | |
| 785 | + String endDate = map.get("endDate").toString(); | |
| 786 | + String nbbm = map.get("nbbm").toString(); | |
| 787 | + String type = map.get("type").toString(); | |
| 788 | + | |
| 789 | + if(startDate.length() == 0){ | |
| 790 | + startDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 791 | + } | |
| 792 | + if(endDate.length() == 0){ | |
| 793 | + endDate = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 794 | + } | |
| 795 | + try { | |
| 796 | + | |
| 797 | + String sql = "select * from bsth_c_s_sp_info_real where DATE_FORMAT(schedule_date,'%Y-%m-%d') >= '"+startDate+"' and DATE_FORMAT(schedule_date,'%Y-%m-%d') <= '"+endDate+"'"; | |
| 798 | + if(line.length() != 0){ | |
| 799 | + sql += " and xl_bm = '"+line+"'"; | |
| 800 | + } | |
| 801 | + if(nbbm.length() != 0){ | |
| 802 | + sql += " and cl_zbh like '%"+nbbm+"%'"; | |
| 803 | + } | |
| 804 | +// if(company.length() != 0){ | |
| 805 | + sql += " and gs_bm like '%"+company+"%' and fgs_bm like '%"+subCompany+"%'"; | |
| 806 | +// } | |
| 807 | + sql += " and bc_type != 'in' and bc_type != 'out'"; | |
| 808 | + | |
| 809 | + list = jdbcTemplate.query(sql, | |
| 810 | + new RowMapper<ScheduleRealInfo>(){ | |
| 811 | + @Override | |
| 812 | + public ScheduleRealInfo mapRow(ResultSet rs, int rowNum) throws SQLException { | |
| 813 | + ScheduleRealInfo schedule = new ScheduleRealInfo(); | |
| 814 | + schedule.setScheduleDateStr(rs.getString("schedule_date_Str")); | |
| 815 | + schedule.setRealExecDate(rs.getString("real_exec_date")); | |
| 816 | + schedule.setXlName(rs.getString("xl_name")); | |
| 817 | + schedule.setBcType(rs.getString("bc_type")); | |
| 818 | + schedule.setGsName(rs.getString("gs_name")); | |
| 819 | + schedule.setFgsName(rs.getString("fgs_name")); | |
| 820 | + schedule.setXlDir(rs.getString("xl_dir")); | |
| 821 | + schedule.setBcs(rs.getInt("bcs")); | |
| 822 | + schedule.setFcno(rs.getInt("fcno")); | |
| 823 | + schedule.setFcsj(rs.getString("fcsj")); | |
| 824 | + schedule.setFcsjActual(rs.getString("fcsj_actual")); | |
| 825 | + schedule.setZdsj(rs.getString("zdsj")); | |
| 826 | + schedule.setZdsjActual(rs.getString("zdsj_actual")); | |
| 827 | + schedule.setBcsj(rs.getInt("bcsj")); | |
| 828 | + schedule.setQdzName(rs.getString("qdz_name")); | |
| 829 | + schedule.setSpId(rs.getLong("sp_id")); | |
| 830 | + | |
| 831 | + if(schedule.getFcsj() != null && schedule.getZdsj() != null){ | |
| 832 | + String[] split1 = schedule.getFcsj().split(":"); | |
| 833 | + String[] split2 = schedule.getZdsj().split(":"); | |
| 834 | + int fcsj = Integer.valueOf(split1[0]) * 60 + Integer.valueOf(split1[1]); | |
| 835 | + int zdsj = Integer.valueOf(split2[0]) * 60 + Integer.valueOf(split2[1]); | |
| 836 | + if(zdsj < fcsj){ | |
| 837 | + zdsj += 1440; | |
| 838 | + schedule.setZdsj((zdsj/60>9?zdsj/60:"0"+zdsj/60) + ":" + (zdsj%60>9?zdsj%60:"0"+zdsj%60)); | |
| 839 | + } | |
| 840 | + schedule.setFcsjT((long)fcsj); | |
| 841 | + schedule.setZdsjT((long)zdsj); | |
| 842 | + } | |
| 843 | + if(schedule.getFcsjActual() != null && schedule.getZdsjActual() != null){ | |
| 844 | + String[] split3 = schedule.getFcsjActual().split(":"); | |
| 845 | + String[] split4 = schedule.getZdsjActual().split(":"); | |
| 846 | + int fcsjA = Integer.valueOf(split3[0]) * 60 + Integer.valueOf(split3[1]); | |
| 847 | + int zdsjA = Integer.valueOf(split4[0]) * 60 + Integer.valueOf(split4[1]); | |
| 848 | + if(fcsjA > zdsjA){ | |
| 849 | + zdsjA += 1440; | |
| 850 | + schedule.setZdsjActual((zdsjA/60>9?zdsjA/60:"0"+zdsjA/60) + ":" + (zdsjA%60>9?zdsjA%60:"0"+zdsjA%60)); | |
| 851 | + } | |
| 852 | + schedule.setFcsjActualTime((long)fcsjA); | |
| 853 | + schedule.setZdsjActualTime((long)zdsjA); | |
| 854 | + } | |
| 855 | + | |
| 856 | + return schedule; | |
| 857 | + } | |
| 858 | + }); | |
| 859 | + | |
| 860 | + } catch (Exception e) { | |
| 861 | + // TODO Auto-generated catch block | |
| 862 | + e.printStackTrace(); | |
| 863 | + } | |
| 864 | + | |
| 865 | + { | |
| 866 | + Map<String, Object> m0 = new HashMap<String, Object>(); | |
| 867 | + m0.put("time", "首~6:30"); | |
| 868 | + m0.put("upbc", "0");m0.put("dnbc", "0"); | |
| 869 | + m0.put("upys", "--");m0.put("dnys", "--"); | |
| 870 | + m0.put("pjys", "--"); | |
| 871 | + tempList.add(m0); | |
| 872 | + Map<String, Object> m1 = new HashMap<String, Object>(); | |
| 873 | + m1.put("time", "6:31~8:30"); | |
| 874 | + m1.put("upbc", "0");m1.put("dnbc", "0"); | |
| 875 | + m1.put("upys", "--");m1.put("dnys", "--"); | |
| 876 | + m1.put("pjys", "--"); | |
| 877 | + tempList.add(m1); | |
| 878 | + Map<String, Object> m2 = new HashMap<String, Object>(); | |
| 879 | + m2.put("time", "8:31~11:00"); | |
| 880 | + m2.put("upbc", "0");m2.put("dnbc", "0"); | |
| 881 | + m2.put("upys", "--");m2.put("dnys", "--"); | |
| 882 | + m2.put("pjys", "--"); | |
| 883 | + tempList.add(m2); | |
| 884 | + Map<String, Object> m3 = new HashMap<String, Object>(); | |
| 885 | + m3.put("time", "11:01~13:30"); | |
| 886 | + m3.put("upbc", "0");m3.put("dnbc", "0"); | |
| 887 | + m3.put("upys", "--");m3.put("dnys", "--"); | |
| 888 | + m3.put("pjys", "--"); | |
| 889 | + tempList.add(m3); | |
| 890 | + Map<String, Object> m4 = new HashMap<String, Object>(); | |
| 891 | + m4.put("time", "13:31~16:00"); | |
| 892 | + m4.put("upbc", "0");m4.put("dnbc", "0"); | |
| 893 | + m4.put("upys", "--");m4.put("dnys", "--"); | |
| 894 | + m4.put("pjys", "--"); | |
| 895 | + tempList.add(m4); | |
| 896 | + Map<String, Object> m5 = new HashMap<String, Object>(); | |
| 897 | + m5.put("time", "16:01~18:00"); | |
| 898 | + m5.put("upbc", "0");m5.put("dnbc", "0"); | |
| 899 | + m5.put("upys", "--");m5.put("dnys", "--"); | |
| 900 | + m5.put("pjys", "--"); | |
| 901 | + tempList.add(m5); | |
| 902 | + Map<String, Object> m6 = new HashMap<String, Object>(); | |
| 903 | + m6.put("time", "18:01~20:30"); | |
| 904 | + m6.put("upbc", "0");m6.put("dnbc", "0"); | |
| 905 | + m6.put("upys", "--");m6.put("dnys", "--"); | |
| 906 | + m6.put("pjys", "--"); | |
| 907 | + tempList.add(m6); | |
| 908 | + Map<String, Object> m7 = new HashMap<String, Object>(); | |
| 909 | + m7.put("time", "20:31~末"); | |
| 910 | + m7.put("upbc", "0");m7.put("dnbc", "0"); | |
| 911 | + m7.put("upys", "--");m7.put("dnys", "--"); | |
| 912 | + m7.put("pjys", "--"); | |
| 913 | + tempList.add(m7); | |
| 914 | + } | |
| 915 | + | |
| 916 | + //按时间段分组 | |
| 917 | + for(ScheduleRealInfo schedule : list){ | |
| 918 | + if(schedule.getFcsjActualTime()!=null && schedule.getZdsjActualTime()!=null){ | |
| 919 | + Long fcsjA = schedule.getFcsjActualTime(); | |
| 920 | + if(fcsjA <= 6*60+30){ | |
| 921 | + if(!keyMap.containsKey("首~6:30")) | |
| 922 | + keyMap.put("首~6:30", new ArrayList<ScheduleRealInfo>()); | |
| 923 | + keyMap.get("首~6:30").add(schedule); | |
| 924 | + } | |
| 925 | + if(fcsjA > 6*60+30 && fcsjA <= 8*60+30){ | |
| 926 | + if(!keyMap.containsKey("6:31~8:30")) | |
| 927 | + keyMap.put("6:31~8:30", new ArrayList<ScheduleRealInfo>()); | |
| 928 | + keyMap.get("6:31~8:30").add(schedule); | |
| 929 | + } | |
| 930 | + if(fcsjA > 8*60+30 && fcsjA <= 11*60){ | |
| 931 | + if(!keyMap.containsKey("8:31~11:00")) | |
| 932 | + keyMap.put("8:31~11:00", new ArrayList<ScheduleRealInfo>()); | |
| 933 | + keyMap.get("8:31~11:00").add(schedule); | |
| 934 | + } | |
| 935 | + if(fcsjA > 11*60 && fcsjA <= 13*60+30){ | |
| 936 | + if(!keyMap.containsKey("11:01~13:30")) | |
| 937 | + keyMap.put("11:01~13:30", new ArrayList<ScheduleRealInfo>()); | |
| 938 | + keyMap.get("11:01~13:30").add(schedule); | |
| 939 | + } | |
| 940 | + if(fcsjA > 13*60+30 && fcsjA <= 16*60){ | |
| 941 | + if(!keyMap.containsKey("13:31~16:00")) | |
| 942 | + keyMap.put("13:31~16:00", new ArrayList<ScheduleRealInfo>()); | |
| 943 | + keyMap.get("13:31~16:00").add(schedule); | |
| 944 | + } | |
| 945 | + if(fcsjA > 16*60 && fcsjA <= 18*60){ | |
| 946 | + if(!keyMap.containsKey("16:01~18:00")) | |
| 947 | + keyMap.put("16:01~18:00", new ArrayList<ScheduleRealInfo>()); | |
| 948 | + keyMap.get("16:01~18:00").add(schedule); | |
| 949 | + } | |
| 950 | + if(fcsjA > 18*60 && fcsjA <= 20*60+30){ | |
| 951 | + if(!keyMap.containsKey("18:01~20:30")) | |
| 952 | + keyMap.put("18:01~20:30", new ArrayList<ScheduleRealInfo>()); | |
| 953 | + keyMap.get("18:01~20:30").add(schedule); | |
| 954 | + } | |
| 955 | + if(fcsjA > 20*60+30){ | |
| 956 | + if(!keyMap.containsKey("20:31~末")) | |
| 957 | + keyMap.put("20:31~末", new ArrayList<ScheduleRealInfo>()); | |
| 958 | + keyMap.get("20:31~末").add(schedule); | |
| 959 | + } | |
| 960 | + } | |
| 961 | + } | |
| 962 | + | |
| 963 | + for(String key : keyMap.keySet()){ | |
| 964 | + Map<String, Object> m = null; | |
| 965 | + for(Map<String, Object> map2 : tempList){ | |
| 966 | + if(map2.get("time").toString().equals(key)){ | |
| 967 | + m = map2; | |
| 968 | + } | |
| 969 | + } | |
| 970 | + int upbc = 0, dnbc = 0; | |
| 971 | + long upys = 0, dnys = 0; | |
| 972 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | |
| 973 | + if(schedule.getXlDir().equals("0")){ | |
| 974 | + upbc++; | |
| 975 | + upys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); | |
| 976 | + }else if(schedule.getXlDir().equals("1")){ | |
| 977 | + dnbc++; | |
| 978 | + dnys += schedule.getZdsjActualTime() - schedule.getFcsjActualTime(); | |
| 979 | + } | |
| 980 | + } | |
| 981 | + m.put("upbc", upbc); | |
| 982 | + m.put("dnbc", dnbc); | |
| 983 | + m.put("upys", nf.format((float)upys / upbc)); | |
| 984 | + m.put("dnys", nf.format((float)dnys / dnbc)); | |
| 985 | + m.put("pjys", nf.format((float) (upys + dnys) / (upbc + dnbc))); | |
| 986 | + } | |
| 987 | + | |
| 988 | + modelMap.put("dataList", tempList); | |
| 989 | + | |
| 990 | + //导出 | |
| 991 | + if(type.equals("export")){ | |
| 992 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 993 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 994 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 995 | + Map<String,Object> m = new HashMap<String, Object>(); | |
| 996 | + ReportUtils ee = new ReportUtils(); | |
| 997 | + try { | |
| 998 | + listI.add(tempList.iterator()); | |
| 999 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 1000 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/scheduleAnaly_sum.xls", | |
| 1001 | + path+"export/时刻表分析(汇总)" + sdfSimple.format(sdfMonth.parse(startDate)) + "-" + sdfSimple.format(sdfMonth.parse(endDate)) + ".xls"); | |
| 1002 | + } catch (Exception e) { | |
| 1003 | + // TODO: handle exception | |
| 1004 | + e.printStackTrace(); | |
| 1005 | + } | |
| 1006 | + } | |
| 1007 | + | |
| 1008 | + return modelMap; | |
| 1009 | + } | |
| 762 | 1010 | |
| 763 | 1011 | @Override |
| 764 | 1012 | public List<Map<String, Object>> getModel(Map<String, Object> map) { |
| ... | ... | @@ -908,6 +1156,181 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 908 | 1156 | List<Long> longList1 = new ArrayList<Long>(); |
| 909 | 1157 | String companyName = "", subCompanyName = ""; |
| 910 | 1158 | for(ScheduleRealInfo schedule : keyMap.get(key)){ |
| 1159 | + if(schedule.getFcsjActual() == null || schedule.getFcsjActual().trim().length() == 0){ | |
| 1160 | + continue; | |
| 1161 | + } | |
| 1162 | + if(schedule.getGsName() != null && companyName.length() == 0) | |
| 1163 | + companyName = schedule.getGsName(); | |
| 1164 | + if(schedule.getFgsName() != null && subCompanyName.length() == 0) | |
| 1165 | + subCompanyName = schedule.getFgsName(); | |
| 1166 | + String[] split = schedule.getFcsj().split(":"); | |
| 1167 | + long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1168 | + schedule.setFcsjT(min); | |
| 1169 | + if(schedule.getXlDir().equals("0")){ | |
| 1170 | + temp0.put(min, schedule); | |
| 1171 | + longList0.add(min); | |
| 1172 | + } else { | |
| 1173 | + temp1.put(min, schedule); | |
| 1174 | + longList1.add(min); | |
| 1175 | + } | |
| 1176 | + } | |
| 1177 | + if(longList0.size() == 0 || longList1.size() == 0){ | |
| 1178 | + continue; | |
| 1179 | + } | |
| 1180 | + if(longList0.size() != 0){ | |
| 1181 | + Collections.sort(longList0); | |
| 1182 | + ScheduleRealInfo shouban0 = temp0.get(longList0.get(0)); | |
| 1183 | + ScheduleRealInfo moban0 = temp0.get(longList0.get(longList0.size() - 1)); | |
| 1184 | + tempMap.put("qdzFirst0", shouban0.getQdzName()); | |
| 1185 | + tempMap.put("jhfcFirst0", shouban0.getFcsj()); | |
| 1186 | + tempMap.put("qdzLast0", moban0.getQdzName()); | |
| 1187 | + tempMap.put("jhfcLast0", moban0.getFcsj()); | |
| 1188 | + if(shouban0.getFcsjActual() != null){ | |
| 1189 | + String[] split = shouban0.getFcsjActual().split(":"); | |
| 1190 | + long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1191 | + long delay = shouban0.getFcsjT() - min; | |
| 1192 | + tempMap.put("sjfcFirst0", shouban0.getFcsjActual()); | |
| 1193 | + if(delay > 0) | |
| 1194 | + tempMap.put("delayFirst0", "+" + delay); | |
| 1195 | + else | |
| 1196 | + tempMap.put("delayFirst0", delay); | |
| 1197 | + } else { | |
| 1198 | + tempMap.put("sjfcFirst0", "/"); | |
| 1199 | + tempMap.put("delayFirst0", "/"); | |
| 1200 | + } | |
| 1201 | + if(moban0.getFcsjActual() != null){ | |
| 1202 | + String[] split = moban0.getFcsjActual().split(":"); | |
| 1203 | + long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1204 | + long delay = moban0.getFcsjT() - min; | |
| 1205 | + tempMap.put("sjfcLast0", moban0.getFcsjActual()); | |
| 1206 | + if(delay > 0) | |
| 1207 | + tempMap.put("delayLast0", "+" + delay); | |
| 1208 | + else | |
| 1209 | + tempMap.put("delayLast0", delay); | |
| 1210 | + } else { | |
| 1211 | + tempMap.put("sjfcLast0", "/"); | |
| 1212 | + tempMap.put("delayLast0", "/"); | |
| 1213 | + } | |
| 1214 | + }else{ | |
| 1215 | + tempMap.put("qdzFirst0", "--"); | |
| 1216 | + tempMap.put("jhfcFirst0", "/"); | |
| 1217 | + tempMap.put("qdzLast0", "--"); | |
| 1218 | + tempMap.put("jhfcLast0", "/"); | |
| 1219 | + tempMap.put("sjfcFirst0", "/"); | |
| 1220 | + tempMap.put("delayFirst0", "/"); | |
| 1221 | + tempMap.put("sjfcLast0", "/"); | |
| 1222 | + tempMap.put("delayLast0", "/"); | |
| 1223 | + } | |
| 1224 | + | |
| 1225 | + if(longList1.size() != 0){ | |
| 1226 | + Collections.sort(longList1); | |
| 1227 | + ScheduleRealInfo shouban1 = temp1.get(longList1.get(0)); | |
| 1228 | + ScheduleRealInfo moban1 = temp1.get(longList1.get(longList1.size() - 1)); | |
| 1229 | + tempMap.put("qdzFirst1", shouban1.getQdzName()); | |
| 1230 | + tempMap.put("jhfcFirst1", shouban1.getFcsj()); | |
| 1231 | + tempMap.put("qdzLast1", moban1.getQdzName()); | |
| 1232 | + tempMap.put("jhfcLast1", moban1.getFcsj()); | |
| 1233 | + if(shouban1.getFcsjActual() != null){ | |
| 1234 | + String[] split = shouban1.getFcsjActual().split(":"); | |
| 1235 | + long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1236 | + long delay = shouban1.getFcsjT() - min; | |
| 1237 | + tempMap.put("sjfcFirst1", shouban1.getFcsjActual()); | |
| 1238 | + if(delay > 0) | |
| 1239 | + tempMap.put("delayFirst1", "+" + delay); | |
| 1240 | + else | |
| 1241 | + tempMap.put("delayFirst1", delay); | |
| 1242 | + } else { | |
| 1243 | + tempMap.put("sjfcFirst1", "/"); | |
| 1244 | + tempMap.put("delayFirst1", "/"); | |
| 1245 | + } | |
| 1246 | + if(moban1.getFcsjActual() != null){ | |
| 1247 | + String[] split = moban1.getFcsjActual().split(":"); | |
| 1248 | + long min = Integer.valueOf(split[0])*60 + Integer.valueOf(split[1]); | |
| 1249 | + long delay = moban1.getFcsjT() - min; | |
| 1250 | + tempMap.put("sjfcLast1", moban1.getFcsjActual()); | |
| 1251 | + if(delay > 0) | |
| 1252 | + tempMap.put("delayLast1", "+" + delay); | |
| 1253 | + else | |
| 1254 | + tempMap.put("delayLast1", delay); | |
| 1255 | + } else { | |
| 1256 | + tempMap.put("sjfcLast1", "/"); | |
| 1257 | + tempMap.put("delayLast1", "/"); | |
| 1258 | + } | |
| 1259 | + }else{ | |
| 1260 | + tempMap.put("qdzFirst1", "--"); | |
| 1261 | + tempMap.put("jhfcFirst1", "/"); | |
| 1262 | + tempMap.put("qdzLast1", "--"); | |
| 1263 | + tempMap.put("jhfcLast1", "/"); | |
| 1264 | + tempMap.put("sjfcFirst1", "/"); | |
| 1265 | + tempMap.put("delayFirst1", "/"); | |
| 1266 | + tempMap.put("sjfcLast1", "/"); | |
| 1267 | + tempMap.put("delayLast1", "/"); | |
| 1268 | + } | |
| 1269 | + | |
| 1270 | + tempMap.put("date", date); | |
| 1271 | + tempMap.put("company", companyName); | |
| 1272 | + tempMap.put("subCompany", subCompanyName); | |
| 1273 | + tempMap.put("line", key); | |
| 1274 | + resList.add(tempMap); | |
| 1275 | + } | |
| 1276 | + | |
| 1277 | + if(type.equals("export")){ | |
| 1278 | + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), | |
| 1279 | + sdfSimple = new SimpleDateFormat("yyyyMMdd"); | |
| 1280 | + List<Iterator<?>> listI = new ArrayList<Iterator<?>>(); | |
| 1281 | + Map<String,Object> m = new HashMap<String, Object>(); | |
| 1282 | + ReportUtils ee = new ReportUtils(); | |
| 1283 | + try { | |
| 1284 | + listI.add(resList.iterator()); | |
| 1285 | + String path = this.getClass().getResource("/").getPath()+"static/pages/forms/"; | |
| 1286 | + ee.excelReplace(listI, new Object[] { m }, path+"mould/firstAndLastBus.xls", | |
| 1287 | + path+"export/线路首末班" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); | |
| 1288 | + } catch (Exception e) { | |
| 1289 | + // TODO: handle exception | |
| 1290 | + e.printStackTrace(); | |
| 1291 | + } | |
| 1292 | + } | |
| 1293 | + | |
| 1294 | + return resList; | |
| 1295 | + } | |
| 1296 | + | |
| 1297 | + @Override | |
| 1298 | + public List<Map<String, Object>> firstAndLastBus_sum(Map<String, Object> map) { | |
| 1299 | + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | |
| 1300 | + Map<String, List<ScheduleRealInfo>> keyMap = new HashMap<String, List<ScheduleRealInfo>>(); | |
| 1301 | + | |
| 1302 | + String company = map.get("company").toString(); | |
| 1303 | + String subCompany = map.get("subCompany").toString(); | |
| 1304 | + String line = map.get("line").toString(); | |
| 1305 | + String date = map.get("date").toString(); | |
| 1306 | + String type = map.get("type").toString(); | |
| 1307 | + | |
| 1308 | + if(date.length() == 0) | |
| 1309 | + date = new SimpleDateFormat("yyyy-MM-dd").format(new Date()); | |
| 1310 | + | |
| 1311 | + List<ScheduleRealInfo> list = this.getSchedule(company, subCompany, line, date); | |
| 1312 | + | |
| 1313 | + for(ScheduleRealInfo schedule : list){ | |
| 1314 | + if(schedule.getBcType().equals("in") || schedule.getBcType().equals("out")) | |
| 1315 | + continue; | |
| 1316 | + String key = schedule.getXlName(); | |
| 1317 | + if(key == null || key.trim().length() == 0) | |
| 1318 | + continue; | |
| 1319 | + if(!keyMap.containsKey(key)) | |
| 1320 | + keyMap.put(key, new ArrayList<ScheduleRealInfo>()); | |
| 1321 | + keyMap.get(key).add(schedule); | |
| 1322 | + } | |
| 1323 | + for(String key : keyMap.keySet()){ | |
| 1324 | + Map<String, Object> tempMap = new HashMap<String, Object>(); | |
| 1325 | + Map<Long, ScheduleRealInfo> temp0 = new HashMap<Long, ScheduleRealInfo>(); | |
| 1326 | + List<Long> longList0 = new ArrayList<Long>(); | |
| 1327 | + Map<Long, ScheduleRealInfo> temp1 = new HashMap<Long, ScheduleRealInfo>(); | |
| 1328 | + List<Long> longList1 = new ArrayList<Long>(); | |
| 1329 | + String companyName = "", subCompanyName = ""; | |
| 1330 | + for(ScheduleRealInfo schedule : keyMap.get(key)){ | |
| 1331 | + if(schedule.getFcsjActual() == null || schedule.getFcsjActual().trim().length() == 0){ | |
| 1332 | + continue; | |
| 1333 | + } | |
| 911 | 1334 | if(schedule.getGsName() != null && companyName.length() == 0) |
| 912 | 1335 | companyName = schedule.getGsName(); |
| 913 | 1336 | if(schedule.getFgsName() != null && subCompanyName.length() == 0) |
| ... | ... | @@ -923,6 +1346,9 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 923 | 1346 | longList1.add(min); |
| 924 | 1347 | } |
| 925 | 1348 | } |
| 1349 | + if(longList0.size() == 0 || longList1.size() == 0){ | |
| 1350 | + continue; | |
| 1351 | + } | |
| 926 | 1352 | Collections.sort(longList0); |
| 927 | 1353 | Collections.sort(longList1); |
| 928 | 1354 | ScheduleRealInfo shouban0 = temp0.get(longList0.get(0)); |
| ... | ... | @@ -1015,7 +1441,7 @@ public class PeopleCarPlanServiceImpl implements PeopleCarPlanService { |
| 1015 | 1441 | |
| 1016 | 1442 | return resList; |
| 1017 | 1443 | } |
| 1018 | - | |
| 1444 | + | |
| 1019 | 1445 | @Override |
| 1020 | 1446 | public List<Map<String, Object>> commandState(Map<String, Object> map) { |
| 1021 | 1447 | List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>(); | ... | ... |
src/main/java/com/bsth/websocket/handler/RealControlSocketHandler.java
| ... | ... | @@ -4,7 +4,6 @@ import com.alibaba.fastjson.JSONObject; |
| 4 | 4 | import com.bsth.common.Constants; |
| 5 | 5 | import com.bsth.data.BasicData; |
| 6 | 6 | import com.google.common.base.Splitter; |
| 7 | -import com.google.common.collect.ArrayListMultimap; | |
| 8 | 7 | import org.slf4j.Logger; |
| 9 | 8 | import org.slf4j.LoggerFactory; |
| 10 | 9 | import org.springframework.context.annotation.Scope; |
| ... | ... | @@ -12,6 +11,7 @@ import org.springframework.stereotype.Component; |
| 12 | 11 | import org.springframework.web.socket.*; |
| 13 | 12 | |
| 14 | 13 | import java.util.*; |
| 14 | +import java.util.concurrent.ConcurrentHashMap; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * @author PanZhao |
| ... | ... | @@ -22,12 +22,14 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 22 | 22 | |
| 23 | 23 | Logger logger = LoggerFactory.getLogger(this.getClass()); |
| 24 | 24 | |
| 25 | - private static final ArrayList<WebSocketSession> users; | |
| 26 | - private static final ArrayListMultimap<String, WebSocketSession> listenMap; | |
| 25 | + private static ArrayList<WebSocketSession> users; | |
| 26 | + //private static final ArrayListMultimap<String, WebSocketSession> listenMap; | |
| 27 | + private static ConcurrentHashMap<String, List<WebSocketSession>> listenMap; | |
| 27 | 28 | |
| 28 | 29 | static { |
| 29 | 30 | users = new ArrayList<WebSocketSession>(); |
| 30 | - listenMap = ArrayListMultimap.create(); | |
| 31 | + //listenMap = ArrayListMultimap.create(); | |
| 32 | + listenMap = new ConcurrentHashMap(); | |
| 31 | 33 | } |
| 32 | 34 | |
| 33 | 35 | @Override |
| ... | ... | @@ -35,19 +37,31 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 35 | 37 | throws Exception { |
| 36 | 38 | users.remove(session); |
| 37 | 39 | //清理监听 |
| 38 | - Set<String> keys = listenMap.keySet(); | |
| 39 | - Map<String, WebSocketSession> remMap = new HashMap<>(); | |
| 40 | - for(String k : keys){ | |
| 41 | - if(listenMap.get(k).contains(session)) | |
| 42 | - remMap.put(k, session); | |
| 43 | - } | |
| 40 | + //Set<String> keys = listenMap.keySet(); | |
| 41 | + //Map<String, WebSocketSession> remMap = new HashMap<>(); | |
| 42 | + | |
| 43 | + int vsCount=0; | |
| 44 | + Collection<List<WebSocketSession>> vs = listenMap.values(); | |
| 45 | + for(List<WebSocketSession> list : vs){ | |
| 46 | + list.remove(session); | |
| 44 | 47 | |
| 45 | - Set<String> remSet = remMap.keySet(); | |
| 48 | + vsCount += list.size(); | |
| 49 | + } | |
| 50 | + /*List<WebSocketSession> vs; | |
| 51 | + for(String k : keys){ | |
| 52 | + //vs = listenMap.get(k); | |
| 53 | + //vs.remove(session); | |
| 54 | + listenMap.get(k).remove() | |
| 55 | + *//*if(listenMap.get(k).contains(session)) | |
| 56 | + remMap.put(k, session);*//* | |
| 57 | + }*/ | |
| 58 | + | |
| 59 | + /*Set<String> remSet = remMap.keySet(); | |
| 46 | 60 | for(String k : remSet){ |
| 47 | 61 | listenMap.remove(k, remMap.get(k)); |
| 48 | 62 | logger.info("web socket close, remove listen K: "+ k); |
| 49 | - } | |
| 50 | - logger.info("listen values size: " + listenMap.values().size() + " -CloseStatus:" + arg1); | |
| 63 | + }*/ | |
| 64 | + logger.info("listen values size: " + vsCount + " -CloseStatus:" + arg1); | |
| 51 | 65 | } |
| 52 | 66 | |
| 53 | 67 | @Override |
| ... | ... | @@ -65,8 +79,12 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 65 | 79 | //注册线路监听 |
| 66 | 80 | List<String> idx = Splitter.on(",").splitToList(jsonObj.getString("idx")); |
| 67 | 81 | for(String lineCode : idx){ |
| 68 | - if(BasicData.lineCode2NameMap.containsKey(lineCode)) | |
| 69 | - listenMap.put(lineCode, session); | |
| 82 | + if(BasicData.lineCode2NameMap.containsKey(lineCode)){ | |
| 83 | + if(!listenMap.containsKey(lineCode)){ | |
| 84 | + listenMap.put(lineCode, new ArrayList<WebSocketSession>()); | |
| 85 | + } | |
| 86 | + listenMap.get(lineCode).add(session); | |
| 87 | + } | |
| 70 | 88 | } |
| 71 | 89 | break; |
| 72 | 90 | |
| ... | ... | @@ -97,12 +115,11 @@ public class RealControlSocketHandler implements WebSocketHandler { |
| 97 | 115 | public void sendMessageToLine(String lineCode, String msg) { |
| 98 | 116 | |
| 99 | 117 | TextMessage message = new TextMessage(msg.getBytes()); |
| 118 | + List<WebSocketSession> list = listenMap.get(lineCode); | |
| 119 | + if(list == null || list.size() == 0) | |
| 120 | + return; | |
| 100 | 121 | |
| 101 | - Iterator<WebSocketSession> iterator = listenMap.get(lineCode).iterator(); | |
| 102 | - | |
| 103 | - WebSocketSession user; | |
| 104 | - while(iterator.hasNext()){ | |
| 105 | - user = iterator.next(); | |
| 122 | + for(WebSocketSession user : list){ | |
| 106 | 123 | try { |
| 107 | 124 | if (user.isOpen()) { |
| 108 | 125 | user.sendMessage(message); | ... | ... |
src/main/resources/rules/shiftloop_fb_2.drl
| ... | ... | @@ -148,7 +148,8 @@ rule "Calcu_SchedulePlanRuleResult_wrap" |
| 148 | 148 | $self: schedulePlan |
| 149 | 149 | ) |
| 150 | 150 | eval($self.getIsHistoryPlanFirst() == true) // 是否使用历史排班标识 |
| 151 | - $sprr: SchedulePlanRuleResult($qyrq: qyrq) from scheduleRuleService.findLastByXl($xlId, $fromDate.toDate()) | |
| 151 | + $sprr: SchedulePlanRuleResult() from scheduleRuleService.findLastByXl($xlId, $fromDate.toDate()) | |
| 152 | + eval($sprr.getQyrq() != null) | |
| 152 | 153 | |
| 153 | 154 | then |
| 154 | 155 | // 创建班序历史结果数据 |
| ... | ... | @@ -159,7 +160,7 @@ rule "Calcu_SchedulePlanRuleResult_wrap" |
| 159 | 160 | |
| 160 | 161 | // 规则Md5编码 |
| 161 | 162 | String md5 = Md5Util.getMd5( |
| 162 | - String.valueOf($qyrq.getTime()) + "_" + | |
| 163 | + String.valueOf($sprr.getQyrq().getTime()) + "_" + | |
| 163 | 164 | $sprr.getGids() + "_" + $sprr.getEcids() |
| 164 | 165 | ); |
| 165 | 166 | |
| ... | ... | @@ -325,6 +326,7 @@ rule "Calcu_loop2_1_" // 路牌在时刻表中存在,就翻 |
| 325 | 326 | schedulePlanRuleResult.setScheduleDate($csd2.toDate()); |
| 326 | 327 | schedulePlanRuleResult.setTtinfoId($ttinfoId); |
| 327 | 328 | schedulePlanRuleResult.setTtinfoName($ttinfoName); |
| 329 | + schedulePlanRuleResult.setQyrq($sri.getQyrq().toDate()); | |
| 328 | 330 | |
| 329 | 331 | scheduleResult.getSchedulePlanRuleResults().add(schedulePlanRuleResult); |
| 330 | 332 | ... | ... |