Commit 54c3fcd2cee94b1d4e69d50ecbbc52ae964e54f7
Merge branch 'jiading' of 192.168.168.201:panzhaov5/bsth_control into jiading
Showing
3 changed files
with
1125 additions
and
1122 deletions
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
| 1 | -package com.bsth.controller.realcontrol; | |
| 2 | - | |
| 3 | -import java.io.ByteArrayOutputStream; | |
| 4 | -import java.io.IOException; | |
| 5 | -import java.io.InputStream; | |
| 6 | -import java.io.OutputStream; | |
| 7 | -import java.net.HttpURLConnection; | |
| 8 | -import java.net.URL; | |
| 9 | -import java.util.ArrayList; | |
| 10 | -import java.util.Collection; | |
| 11 | -import java.util.HashMap; | |
| 12 | -import java.util.List; | |
| 13 | -import java.util.Map; | |
| 14 | - | |
| 15 | -import org.apache.commons.io.IOUtils; | |
| 16 | -import org.apache.commons.lang3.StringEscapeUtils; | |
| 17 | -import org.joda.time.format.DateTimeFormat; | |
| 18 | -import org.joda.time.format.DateTimeFormatter; | |
| 19 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | -import org.springframework.web.bind.annotation.PathVariable; | |
| 21 | -import org.springframework.web.bind.annotation.RequestMapping; | |
| 22 | -import org.springframework.web.bind.annotation.RequestMethod; | |
| 23 | -import org.springframework.web.bind.annotation.RequestParam; | |
| 24 | -import org.springframework.web.bind.annotation.RestController; | |
| 25 | - | |
| 26 | -import com.alibaba.fastjson.JSONArray; | |
| 27 | -import com.bsth.common.ResponseCode; | |
| 28 | -import com.bsth.controller.BaseController; | |
| 29 | -import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 30 | -import com.bsth.controller.realcontrol.dto.DfsjChange; | |
| 31 | -import com.bsth.data.BasicData; | |
| 32 | -import com.bsth.data.schedule.DayOfSchedule; | |
| 33 | -import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 34 | -import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 35 | -import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 36 | -import com.bsth.entity.sys.SysUser; | |
| 37 | -import com.bsth.security.util.SecurityUtils; | |
| 38 | -import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 39 | -import com.bsth.util.ConfigUtil; | |
| 40 | -import com.fasterxml.jackson.databind.ObjectMapper; | |
| 41 | - | |
| 42 | -@RestController | |
| 43 | -@RequestMapping("/realSchedule") | |
| 44 | -public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> { | |
| 45 | - | |
| 46 | - @Autowired | |
| 47 | - ScheduleRealInfoService scheduleRealInfoService; | |
| 48 | - | |
| 49 | - @Autowired | |
| 50 | - DayOfSchedule dayOfSchedule; | |
| 51 | - | |
| 52 | - @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST) | |
| 53 | - public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){ | |
| 54 | - return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm); | |
| 55 | - } | |
| 56 | - | |
| 57 | - @RequestMapping(value = "/lines") | |
| 58 | - public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) { | |
| 59 | - return scheduleRealInfoService.findByLines(lines); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @RequestMapping(value = "/car") | |
| 63 | - public List<ScheduleRealInfo> findByCar(String nbbm){ | |
| 64 | - return dayOfSchedule.findByNbbm(nbbm); | |
| 65 | - } | |
| 66 | - | |
| 67 | - /** | |
| 68 | - * | |
| 69 | - * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id | |
| 70 | - * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws | |
| 71 | - */ | |
| 72 | - @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) | |
| 73 | - public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, | |
| 74 | - @RequestParam String dfsj,String bcType, | |
| 75 | - @RequestParam(defaultValue = "") String opType) { | |
| 76 | - return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null); | |
| 77 | - } | |
| 78 | - | |
| 79 | - /** | |
| 80 | - * | |
| 81 | - * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔 | |
| 82 | - */ | |
| 83 | - @RequestMapping(value = "/destroy", method = RequestMethod.POST) | |
| 84 | - public Map<String, Object> destroy(@RequestParam String idsStr | |
| 85 | - /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, | |
| 86 | - @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { | |
| 87 | - return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null); | |
| 88 | - } | |
| 89 | - | |
| 90 | - /** | |
| 91 | - * | |
| 92 | - * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws | |
| 93 | - */ | |
| 94 | - @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET) | |
| 95 | - public Map<String, String> carDeviceMapp() { | |
| 96 | - return BasicData.deviceId2NbbmMap.inverse(); | |
| 97 | - } | |
| 98 | - | |
| 99 | - /** | |
| 100 | - * | |
| 101 | - * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param | |
| 102 | - * lineId @throws | |
| 103 | - */ | |
| 104 | - @RequestMapping(value = "/driver", method = RequestMethod.GET) | |
| 105 | - public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) { | |
| 106 | - return scheduleRealInfoService.findDriverByLine(lineCode); | |
| 107 | - } | |
| 108 | - | |
| 109 | - /** | |
| 110 | - * | |
| 111 | - * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param | |
| 112 | - * lineId @throws | |
| 113 | - */ | |
| 114 | - @RequestMapping(value = "/conductor", method = RequestMethod.GET) | |
| 115 | - public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) { | |
| 116 | - return scheduleRealInfoService.findConductorByLine(lineCode); | |
| 117 | - } | |
| 118 | - | |
| 119 | - /** | |
| 120 | - * | |
| 121 | - * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param | |
| 122 | - * lineId @throws | |
| 123 | - */ | |
| 124 | - @RequestMapping(value = "/cars", method = RequestMethod.GET) | |
| 125 | - public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) { | |
| 126 | - return scheduleRealInfoService.findCarByLine(lineCode); | |
| 127 | - } | |
| 128 | - | |
| 129 | - /** | |
| 130 | - * | |
| 131 | - * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws | |
| 132 | - */ | |
| 133 | - @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET) | |
| 134 | - public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) { | |
| 135 | - return scheduleRealInfoService.sreachVehic(nbbm); | |
| 136 | - } | |
| 137 | - /** | |
| 138 | - * | |
| 139 | - * @Title: realOutAdjust | |
| 140 | - * @Description: TODO(实发调整) | |
| 141 | - * @param @param id 班次ID | |
| 142 | - * @param @param fcsjActual 实际发车时间 HH:mm | |
| 143 | - * @param @param remarks 备注 | |
| 144 | - * @throws | |
| 145 | - */ | |
| 146 | - @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) | |
| 147 | - public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual, | |
| 148 | - @RequestParam String remarks) { | |
| 149 | - return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); | |
| 150 | - } | |
| 151 | - | |
| 152 | - /** | |
| 153 | - * | |
| 154 | - * @Title: revokeDestroy | |
| 155 | - * @Description: TODO(撤销烂班) | |
| 156 | - * @param @param id | |
| 157 | - * @throws | |
| 158 | - */ | |
| 159 | - @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST) | |
| 160 | - public Map<String, Object> revokeDestroy(@RequestParam Long id){ | |
| 161 | - return scheduleRealInfoService.revokeDestroy(id); | |
| 162 | - } | |
| 163 | - | |
| 164 | - /** | |
| 165 | - * | |
| 166 | - * @Title: revokeRealOutgo | |
| 167 | - * @Description: TODO(撤销实发) | |
| 168 | - * @param @param id | |
| 169 | - * @throws | |
| 170 | - */ | |
| 171 | - @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST) | |
| 172 | - public Map<String, Object> revokeRealOutgo(@RequestParam Long id){ | |
| 173 | - return scheduleRealInfoService.revokeRealOutgo(id); | |
| 174 | - } | |
| 175 | - | |
| 176 | - /** | |
| 177 | - * 撤销执行 | |
| 178 | - * @param id | |
| 179 | - * @return | |
| 180 | - */ | |
| 181 | - @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST) | |
| 182 | - public Map<String, Object> revokeRealArrive(@RequestParam Long id){ | |
| 183 | - return scheduleRealInfoService.revokeRealArrive(id); | |
| 184 | - } | |
| 185 | - | |
| 186 | - /** | |
| 187 | - * | |
| 188 | - * @Title: spaceAdjust | |
| 189 | - * @Description: TODO(间隔调整) | |
| 190 | - * @param @param ids 要调整的班次数组ID | |
| 191 | - * @param @param space 间隔 | |
| 192 | - * @throws | |
| 193 | - */ | |
| 194 | - @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST) | |
| 195 | - public Map<String, Object> spaceAdjust(Long[] ids, Integer space){ | |
| 196 | - return scheduleRealInfoService.spaceAdjust(ids, space); | |
| 197 | - } | |
| 198 | - | |
| 199 | - /** | |
| 200 | - * | |
| 201 | - * @Title: schInfoFineTune | |
| 202 | - * @Description: TODO(发车信息微调) | |
| 203 | - * @param @param map | |
| 204 | - * @throws | |
| 205 | - */ | |
| 206 | - @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST) | |
| 207 | - public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){ | |
| 208 | - return scheduleRealInfoService.schInfoFineTune(map); | |
| 209 | - } | |
| 210 | - | |
| 211 | - /** | |
| 212 | - * | |
| 213 | - * @Title: outgoAdjustAll | |
| 214 | - * @Description: TODO(批量待发调整) | |
| 215 | - * @param @param list | |
| 216 | - * @throws | |
| 217 | - */ | |
| 218 | - @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST) | |
| 219 | - public Map<String, Object> outgoAdjustAll(@RequestParam String params){ | |
| 220 | - //反转义 | |
| 221 | - params = StringEscapeUtils.unescapeHtml4(params); | |
| 222 | - return scheduleRealInfoService.outgoAdjustAll(params); | |
| 223 | - } | |
| 224 | - | |
| 225 | - /** | |
| 226 | - * | |
| 227 | - * @Title: findByLineAndUpDown | |
| 228 | - * @Description: TODO(根据线路和走向获取班次) | |
| 229 | - * @param @param line | |
| 230 | - * @param @param upDown | |
| 231 | - */ | |
| 232 | - @RequestMapping(value = "/findByLineAndUpDown") | |
| 233 | - public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){ | |
| 234 | - return dayOfSchedule.findByLineAndUpDown(line, upDown); | |
| 235 | - } | |
| 236 | - | |
| 237 | - /** | |
| 238 | - * | |
| 239 | - * @Title: findRouteByLine | |
| 240 | - * @Description: TODO(获取线路的站点,路段路由) | |
| 241 | - * @param @param lineCode | |
| 242 | - * @throws | |
| 243 | - */ | |
| 244 | - @RequestMapping(value = "/findRouteByLine") | |
| 245 | - public Map<String, Object> findRouteByLine(@RequestParam String lineCode){ | |
| 246 | - return scheduleRealInfoService.findRouteByLine(lineCode); | |
| 247 | - } | |
| 248 | - | |
| 249 | - /** | |
| 250 | - * | |
| 251 | - * @Title: removeChildTask | |
| 252 | - * @Description: TODO(删除子任务) | |
| 253 | - * @param @param taskId 子任务ID | |
| 254 | - * @throws | |
| 255 | - */ | |
| 256 | - @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE) | |
| 257 | - public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){ | |
| 258 | - return scheduleRealInfoService.removeChildTask(taskId); | |
| 259 | - } | |
| 260 | - | |
| 261 | - /** | |
| 262 | - * | |
| 263 | - * @Title: findByLineCode | |
| 264 | - * @Description: TODO(根据线路获取班次信息) | |
| 265 | - * @param @param lineCode | |
| 266 | - */ | |
| 267 | - @RequestMapping(value = "/lineCode/{lineCode}") | |
| 268 | - public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){ | |
| 269 | - return dayOfSchedule.findByLineCode(lineCode); | |
| 270 | - } | |
| 271 | - | |
| 272 | - @RequestMapping(value = "/queryUserInfo") | |
| 273 | - public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, | |
| 274 | - @RequestParam String date,@RequestParam String state) { | |
| 275 | - return scheduleRealInfoService.queryUserInfo(line, date,state); | |
| 276 | - } | |
| 277 | - | |
| 278 | - @RequestMapping(value = "/queryUserInfoPx") | |
| 279 | - public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line, | |
| 280 | - @RequestParam String date,@RequestParam String state,@RequestParam String type) { | |
| 281 | - return scheduleRealInfoService.queryUserInfoPx(line, date,state,type); | |
| 282 | - } | |
| 283 | - | |
| 284 | - @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET) | |
| 285 | - public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh, | |
| 286 | - @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { | |
| 287 | - return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line); | |
| 288 | - } | |
| 289 | - | |
| 290 | - @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET) | |
| 291 | - public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh | |
| 292 | - ,@RequestParam String date,@RequestParam String line) { | |
| 293 | - return scheduleRealInfoService.exportWaybillQp( clZbh, date,line); | |
| 294 | - } | |
| 295 | - | |
| 296 | - | |
| 297 | - @RequestMapping(value = "/dailyInfo") | |
| 298 | - public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) { | |
| 299 | - return scheduleRealInfoService.dailyInfo(line, date, type); | |
| 300 | - } | |
| 301 | - | |
| 302 | - @RequestMapping(value = "/historyMessage") | |
| 303 | - public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date, | |
| 304 | - @RequestParam String code, @RequestParam String type) { | |
| 305 | - return scheduleRealInfoService.historyMessage(line, date, code, type); | |
| 306 | - } | |
| 307 | - | |
| 308 | - @RequestMapping(value="/findLine") | |
| 309 | - public List<Map<String,String>> findLine(@RequestParam String line){ | |
| 310 | - return scheduleRealInfoService.findLine(line); | |
| 311 | - } | |
| 312 | - | |
| 313 | - @RequestMapping(value="/findKMBC",method = RequestMethod.GET) | |
| 314 | - public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | |
| 315 | - ,@RequestParam String date,@RequestParam String line){ | |
| 316 | - return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line); | |
| 317 | - } | |
| 318 | - | |
| 319 | - /** | |
| 320 | - * 路单公里统计 (闵行审计专用) | |
| 321 | - * @param jGh | |
| 322 | - * @param clZbh | |
| 323 | - * @param lpName | |
| 324 | - * @param date | |
| 325 | - * @param line | |
| 326 | - * @return | |
| 327 | - */ | |
| 328 | - @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET) | |
| 329 | - public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | |
| 330 | - ,@RequestParam String date,@RequestParam String line){ | |
| 331 | - return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line); | |
| 332 | - } | |
| 333 | - | |
| 334 | - @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET) | |
| 335 | - public Map<String,Object> findKMBCQp(@RequestParam String clZbh | |
| 336 | - ,@RequestParam String date,@RequestParam String line){ | |
| 337 | - return scheduleRealInfoService.findKMBCQp(clZbh,date,line); | |
| 338 | - } | |
| 339 | - | |
| 340 | - @RequestMapping(value="/findLpName") | |
| 341 | - public List<Map<String,String>> findLpName(@RequestParam String lpName){ | |
| 342 | - return scheduleRealInfoService.findLpName(lpName); | |
| 343 | - } | |
| 344 | - | |
| 345 | - @RequestMapping(value = "/account") | |
| 346 | - public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date, | |
| 347 | - @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { | |
| 348 | - return scheduleRealInfoService.account(line, date, code, xlName, type); | |
| 349 | - } | |
| 350 | - | |
| 351 | - @RequestMapping(value = "/accountPx") | |
| 352 | - public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date, | |
| 353 | - @RequestParam String code,@RequestParam String xlName, @RequestParam String px) { | |
| 354 | - return scheduleRealInfoService.accountPx(line, date, code, xlName, px); | |
| 355 | - } | |
| 356 | - | |
| 357 | - @RequestMapping(value = "/correctForm") | |
| 358 | - public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, | |
| 359 | - @RequestParam String endDate, | |
| 360 | - @RequestParam String lpName, @RequestParam String code, | |
| 361 | - @RequestParam String type,@RequestParam String changType) { | |
| 362 | - return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType); | |
| 363 | - } | |
| 364 | - /** | |
| 365 | - * @Title queryListWaybill | |
| 366 | - * @Description 查询行车路单列表 | |
| 367 | - * @param jName 驾驶员名字 | |
| 368 | - * @param clZbh 车辆自编号(内部编号) | |
| 369 | - * @param lpName 路牌 | |
| 370 | - * @return | |
| 371 | - */ | |
| 372 | - @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET) | |
| 373 | - public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | |
| 374 | - ,@RequestParam String date,@RequestParam String line){ | |
| 375 | - return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line); | |
| 376 | - } | |
| 377 | - | |
| 378 | - /** | |
| 379 | - * @Title queryListWaybill | |
| 380 | - * @Description 查询行车路单列表(闵行审计专用路单) | |
| 381 | - * @param jName 驾驶员名字 | |
| 382 | - * @param clZbh 车辆自编号(内部编号) | |
| 383 | - * @param lpName 路牌 | |
| 384 | - * @return | |
| 385 | - */ | |
| 386 | - @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET) | |
| 387 | - public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName | |
| 388 | - ,@RequestParam String date,@RequestParam String line){ | |
| 389 | - return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line); | |
| 390 | - } | |
| 391 | - | |
| 392 | - @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET) | |
| 393 | - public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh, | |
| 394 | - @RequestParam String date,@RequestParam String line){ | |
| 395 | - return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line); | |
| 396 | - } | |
| 397 | - | |
| 398 | - @RequestMapping(value="/statisticsDaily") | |
| 399 | - public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date, | |
| 400 | - @RequestParam String xlName, @RequestParam String type){ | |
| 401 | - return scheduleRealInfoService.statisticsDaily(line, date, xlName, type); | |
| 402 | - } | |
| 403 | - | |
| 404 | - @RequestMapping(value="/statisticsDaily_mh_2") | |
| 405 | - public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date, | |
| 406 | - @RequestParam String xlName, @RequestParam String type){ | |
| 407 | - return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type); | |
| 408 | - } | |
| 409 | - | |
| 410 | - @RequestMapping(value="/statisticsDailyTj") | |
| 411 | - public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | |
| 412 | - String gsdm=""; | |
| 413 | - if(map.get("gsdm")!=null){ | |
| 414 | - gsdm=map.get("gsdm").toString(); | |
| 415 | - } | |
| 416 | - String fgsdm=""; | |
| 417 | - if(map.get("fgsdm")!=null){ | |
| 418 | - fgsdm=map.get("fgsdm").toString(); | |
| 419 | - } | |
| 420 | - String line=""; | |
| 421 | - if(map.get("line")!=null){ | |
| 422 | - line=map.get("line").toString(); | |
| 423 | - } | |
| 424 | - String date=""; | |
| 425 | - if(map.get("date")!=null){ | |
| 426 | - date=map.get("date").toString(); | |
| 427 | - } | |
| 428 | - String date2=""; | |
| 429 | - if(map.get("date2")!=null){ | |
| 430 | - date2=map.get("date2").toString(); | |
| 431 | - } | |
| 432 | - String xlName=""; | |
| 433 | - if(map.get("xlName")!=null){ | |
| 434 | - xlName=map.get("xlName").toString(); | |
| 435 | - } | |
| 436 | - String type=""; | |
| 437 | - if(map.get("type")!=null){ | |
| 438 | - type=map.get("type").toString(); | |
| 439 | - } | |
| 440 | - String nature="0"; | |
| 441 | - if(map.get("nature")!=null){ | |
| 442 | - nature=map.get("nature").toString(); | |
| 443 | - } | |
| 444 | - return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature); | |
| 445 | - } | |
| 446 | - | |
| 447 | - /* | |
| 448 | - * 公里修正报表 | |
| 449 | - */ | |
| 450 | - @RequestMapping(value="/mileageReportTj") | |
| 451 | - public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){ | |
| 452 | - String gsdm=""; | |
| 453 | - if(map.get("gsdm")!=null){ | |
| 454 | - gsdm=map.get("gsdm").toString(); | |
| 455 | - } | |
| 456 | - String fgsdm=""; | |
| 457 | - if(map.get("fgsdm")!=null){ | |
| 458 | - fgsdm=map.get("fgsdm").toString(); | |
| 459 | - } | |
| 460 | - String line=""; | |
| 461 | - if(map.get("line")!=null){ | |
| 462 | - line=map.get("line").toString(); | |
| 463 | - } | |
| 464 | - String date=""; | |
| 465 | - if(map.get("date")!=null){ | |
| 466 | - date=map.get("date").toString(); | |
| 467 | - } | |
| 468 | - String date2=""; | |
| 469 | - if(map.get("date2")!=null){ | |
| 470 | - date2=map.get("date2").toString(); | |
| 471 | - } | |
| 472 | - String xlName=""; | |
| 473 | - if(map.get("xlName")!=null){ | |
| 474 | - xlName=map.get("xlName").toString(); | |
| 475 | - } | |
| 476 | - return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2); | |
| 477 | - } | |
| 478 | - | |
| 479 | - /* | |
| 480 | - * 班次修正报表 | |
| 481 | - */ | |
| 482 | - @RequestMapping(value="/scheduleCorrectionReport") | |
| 483 | - public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){ | |
| 484 | - String gsdm=""; | |
| 485 | - if(map.get("gsdm")!=null){ | |
| 486 | - gsdm=map.get("gsdm").toString(); | |
| 487 | - } | |
| 488 | - String fgsdm=""; | |
| 489 | - if(map.get("fgsdm")!=null){ | |
| 490 | - fgsdm=map.get("fgsdm").toString(); | |
| 491 | - } | |
| 492 | - String line=""; | |
| 493 | - if(map.get("line")!=null){ | |
| 494 | - line=map.get("line").toString(); | |
| 495 | - } | |
| 496 | - String date=""; | |
| 497 | - if(map.get("date")!=null){ | |
| 498 | - date=map.get("date").toString(); | |
| 499 | - } | |
| 500 | - String date2=""; | |
| 501 | - if(map.get("date2")!=null){ | |
| 502 | - date2=map.get("date2").toString(); | |
| 503 | - } | |
| 504 | - String xlName=""; | |
| 505 | - if(map.get("xlName")!=null){ | |
| 506 | - xlName=map.get("xlName").toString(); | |
| 507 | - } | |
| 508 | - return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2); | |
| 509 | - } | |
| 510 | - | |
| 511 | - @RequestMapping(value="/MapById",method = RequestMethod.GET) | |
| 512 | - public Map<String, Object> MapById(@RequestParam("id") Long id){ | |
| 513 | - return scheduleRealInfoService.MapById(id); | |
| 514 | - } | |
| 515 | - | |
| 516 | - @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET) | |
| 517 | - public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){ | |
| 518 | - return scheduleRealInfoService.MapByIdQp(id); | |
| 519 | - } | |
| 520 | - | |
| 521 | - /** | |
| 522 | - * @Title: scheduleDaily | |
| 523 | - * @Description: TODO(调度日报表) | |
| 524 | - * @param line 线路 | |
| 525 | - * @param date 时间 | |
| 526 | - * @return | |
| 527 | - */ | |
| 528 | - @RequestMapping(value="/scheduleDaily") | |
| 529 | - public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){ | |
| 530 | - return scheduleRealInfoService.scheduleDaily(line,date); | |
| 531 | - } | |
| 532 | - | |
| 533 | - @RequestMapping(value="/realScheduleList") | |
| 534 | - public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){ | |
| 535 | - return scheduleRealInfoService.realScheduleList(line,date); | |
| 536 | - } | |
| 537 | - | |
| 538 | - @RequestMapping(value="/realScheduleList_zrw") | |
| 539 | - public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){ | |
| 540 | - return scheduleRealInfoService.realScheduleList_zrw(line,date); | |
| 541 | - } | |
| 542 | - | |
| 543 | - @RequestMapping(value="/realScheduleList_mh_2") | |
| 544 | - public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){ | |
| 545 | - return scheduleRealInfoService.realScheduleList_mh_2(line,date); | |
| 546 | - } | |
| 547 | - | |
| 548 | - @RequestMapping(value="/realScheduleListQp") | |
| 549 | - public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){ | |
| 550 | - return scheduleRealInfoService.realScheduleListQp(line,date); | |
| 551 | - } | |
| 552 | - | |
| 553 | - @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST) | |
| 554 | - public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ | |
| 555 | - cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); | |
| 556 | - List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); | |
| 557 | - return scheduleRealInfoService.multi_tzrc(cpcs, null); | |
| 558 | - } | |
| 559 | - | |
| 560 | - @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) | |
| 561 | - public Map<String, Object> multi_dftz(@RequestParam String dcsJson){ | |
| 562 | - dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson); | |
| 563 | - List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class); | |
| 564 | - return scheduleRealInfoService.multi_dftz(dfsjcs); | |
| 565 | - } | |
| 566 | - | |
| 567 | - @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST) | |
| 568 | - public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){ | |
| 569 | - return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName); | |
| 570 | - } | |
| 571 | - | |
| 572 | - @RequestMapping(value="/history", method=RequestMethod.POST) | |
| 573 | - public Map<String,Object> historySave(ScheduleRealInfo sch){ | |
| 574 | - return scheduleRealInfoService.historySave(sch); | |
| 575 | - } | |
| 576 | - | |
| 577 | - | |
| 578 | - private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 579 | - private final static long ONE_DAY = 1000 * 60 * 60 * 24; | |
| 580 | - /** | |
| 581 | - * 获取可编辑的历史班次日期 | |
| 582 | - * @return | |
| 583 | - */ | |
| 584 | - @RequestMapping("dateArray") | |
| 585 | - public List<String> dateArray(@RequestParam(defaultValue = "0") int c){ | |
| 586 | - List<String> rs = new ArrayList<>(); | |
| 587 | - | |
| 588 | - long t = System.currentTimeMillis(); | |
| 589 | - if(c != 1) | |
| 590 | - t -= (ONE_DAY + (1000 * 60 * 60 * 6)); | |
| 591 | - for(int i = 0; i < 3; i ++){ | |
| 592 | - rs.add(fmtyyyyMMdd.print(t)); | |
| 593 | - t -= ONE_DAY; | |
| 594 | - } | |
| 595 | - return rs; | |
| 596 | - } | |
| 597 | - | |
| 598 | - @RequestMapping(value = "svgAttr", method = RequestMethod.POST) | |
| 599 | - public Map<String, Object> svgAttr(@RequestParam String jsonStr){ | |
| 600 | - return scheduleRealInfoService.svgAttr(jsonStr); | |
| 601 | - } | |
| 602 | - | |
| 603 | - @RequestMapping(value = "svgAttr", method = RequestMethod.GET) | |
| 604 | - public Map<String, Object> findSvgAttr(@RequestParam String idx){ | |
| 605 | - return scheduleRealInfoService.findSvgAttr(idx); | |
| 606 | - } | |
| 607 | - | |
| 608 | - @RequestMapping(value = "addRemarks", method = RequestMethod.POST) | |
| 609 | - public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){ | |
| 610 | - return scheduleRealInfoService.addRemarks(id, remarks); | |
| 611 | - } | |
| 612 | - | |
| 613 | - @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET) | |
| 614 | - public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){ | |
| 615 | - return scheduleRealInfoService.scheduleDailyQp(line,date); | |
| 616 | - } | |
| 617 | - | |
| 618 | - @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET) | |
| 619 | - public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){ | |
| 620 | - return scheduleRealInfoService.scheduleDailyExport(map); | |
| 621 | - } | |
| 622 | - | |
| 623 | - @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | |
| 624 | - public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | |
| 625 | - return scheduleRealInfoService.exportWaybillMore(map); | |
| 626 | - } | |
| 627 | - | |
| 628 | - /** | |
| 629 | - * 获取当日计划排班 , 从计划表抓取数据 | |
| 630 | - * @return | |
| 631 | - */ | |
| 632 | - @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET) | |
| 633 | - public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){ | |
| 634 | - return scheduleRealInfoService.currentSchedulePlan(lineCode); | |
| 635 | - } | |
| 636 | - | |
| 637 | - @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST) | |
| 638 | - public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){ | |
| 639 | - return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type); | |
| 640 | - } | |
| 641 | - | |
| 642 | - /** | |
| 643 | - * 删除当日实际排班 | |
| 644 | - * @return | |
| 645 | - */ | |
| 646 | - @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST) | |
| 647 | - public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){ | |
| 648 | - return dayOfSchedule.deleteRealSchedule(lineCode); | |
| 649 | - } | |
| 650 | - | |
| 651 | - /** | |
| 652 | - * 从计划表重新加载当日排班 | |
| 653 | - * @param lineCode | |
| 654 | - * @return | |
| 655 | - */ | |
| 656 | - @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST) | |
| 657 | - public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){ | |
| 658 | - Map<String, Object> rs = new HashMap<>(); | |
| 659 | - List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode); | |
| 660 | - if(list != null && list.size() > 0){ | |
| 661 | - rs.put("status", ResponseCode.ERROR); | |
| 662 | - rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。"); | |
| 663 | - return rs; | |
| 664 | - } | |
| 665 | - | |
| 666 | - int code = dayOfSchedule.reloadSch(lineCode); | |
| 667 | - | |
| 668 | - //重新按公司编码索引数据 | |
| 669 | - dayOfSchedule.groupByGsbm(); | |
| 670 | - rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); | |
| 671 | - return rs; | |
| 672 | - } | |
| 673 | - | |
| 674 | - /** | |
| 675 | - * 误点调整 | |
| 676 | - * @param idx | |
| 677 | - * @param minute | |
| 678 | - * @return | |
| 679 | - */ | |
| 680 | - @RequestMapping(value = "lateAdjust", method = RequestMethod.POST) | |
| 681 | - public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){ | |
| 682 | - return scheduleRealInfoService.lateAdjust(idx, minute); | |
| 683 | - } | |
| 684 | - | |
| 685 | - /** | |
| 686 | - * 获取所有应发未到的班次 | |
| 687 | - * @param idx | |
| 688 | - * @return | |
| 689 | - */ | |
| 690 | - @RequestMapping(value = "allLate2") | |
| 691 | - public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ | |
| 692 | - return scheduleRealInfoService.allLate2(idx); | |
| 693 | - } | |
| 694 | - | |
| 695 | - /** | |
| 696 | - * 添加一个临加到历史库 | |
| 697 | - * @param sch | |
| 698 | - * @return | |
| 699 | - */ | |
| 700 | - @RequestMapping(value = "history/add", method = RequestMethod.POST) | |
| 701 | - public Map<String, Object> addToHistory(ScheduleRealInfo sch){ | |
| 702 | - return scheduleRealInfoService.addToHistory(sch); | |
| 703 | - } | |
| 704 | - | |
| 705 | - /** | |
| 706 | - * 从历史库里删除临加班次 | |
| 707 | - * @param sch | |
| 708 | - * @return | |
| 709 | - */ | |
| 710 | - @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE) | |
| 711 | - public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ | |
| 712 | - return scheduleRealInfoService.deleteToHistory(id); | |
| 713 | - } | |
| 714 | - | |
| 715 | - @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST) | |
| 716 | - public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){ | |
| 717 | - Map<String, Object> map =new HashMap<>(); | |
| 718 | - map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode)); | |
| 719 | - return map; | |
| 720 | - } | |
| 721 | - | |
| 722 | - /** | |
| 723 | - * 从历史库里删除临加班次 | |
| 724 | - * @param sch | |
| 725 | - * @return | |
| 726 | - */ | |
| 727 | - @RequestMapping(value = "wxsb", method = RequestMethod.POST) | |
| 728 | - public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){ | |
| 729 | - SysUser user = SecurityUtils.getCurrentUser(); | |
| 730 | - String uname = user.getUserName(); | |
| 731 | - StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url")); | |
| 732 | - url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType")); | |
| 733 | - // 分公司保存格式 分公司编码_公司编码 | |
| 734 | - String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm")); | |
| 735 | - String[] arr = val.split("_"); | |
| 736 | - if (!"22".equals(arr[1])) { | |
| 737 | - Map<String, Object> res = new HashMap<String, Object>(); | |
| 738 | - res.put("status", ResponseCode.ERROR); | |
| 739 | - res.put("msg", "除金高公司外暂未开通此功能"); | |
| 740 | - | |
| 741 | - return res; | |
| 742 | - } | |
| 743 | - url.append("&fgs=").append(arr[0]); | |
| 744 | - | |
| 745 | - return request(url.toString()); | |
| 746 | - } | |
| 747 | - | |
| 748 | - @SuppressWarnings("unchecked") | |
| 749 | - private static Map<String, Object> request(String url) { | |
| 750 | - Map<String, Object> res = new HashMap<String, Object>(); | |
| 751 | - res.put("status", ResponseCode.SUCCESS); | |
| 752 | - InputStream in = null; | |
| 753 | - HttpURLConnection con = null; | |
| 754 | - try { | |
| 755 | - con = (HttpURLConnection)new URL(url).openConnection(); | |
| 756 | - con.setRequestMethod("POST"); | |
| 757 | - con.setRequestProperty("keep-alive", "true"); | |
| 758 | - con.setRequestProperty("accept", "application/json"); | |
| 759 | - con.setRequestProperty("content-type", "application/json"); | |
| 760 | - con.setDoInput(true); | |
| 761 | - con.setReadTimeout(2500); | |
| 762 | - con.setConnectTimeout(2500); | |
| 763 | - | |
| 764 | - con.connect(); | |
| 765 | - if (con.getResponseCode() == 200) { | |
| 766 | - in = con.getInputStream(); | |
| 767 | - ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 768 | - IOUtils.copy(in, bout); bout.close(); | |
| 769 | - Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 770 | - if (!"报修成功".equals(response.get("msg"))) { | |
| 771 | - res.put("status", ResponseCode.ERROR); | |
| 772 | - res.putAll(response); | |
| 773 | - } | |
| 774 | - } | |
| 775 | - } catch (IOException e) { | |
| 776 | - // TODO Auto-generated catch block | |
| 777 | - res.put("status", ResponseCode.ERROR); | |
| 778 | - res.put("msg", "调用上报接口异常"); | |
| 779 | - } finally { | |
| 780 | - try { | |
| 781 | - if (in != null) in.close(); | |
| 782 | - if (con != null) con.disconnect(); | |
| 783 | - } catch (IOException e) { | |
| 784 | - // TODO Auto-generated catch block | |
| 785 | - e.printStackTrace(); | |
| 786 | - } | |
| 787 | - } | |
| 788 | - | |
| 789 | - return res; | |
| 790 | - } | |
| 791 | -} | |
| 1 | +package com.bsth.controller.realcontrol; | |
| 2 | + | |
| 3 | +import java.io.ByteArrayOutputStream; | |
| 4 | +import java.io.IOException; | |
| 5 | +import java.io.InputStream; | |
| 6 | +import java.io.OutputStream; | |
| 7 | +import java.net.HttpURLConnection; | |
| 8 | +import java.net.URL; | |
| 9 | +import java.util.ArrayList; | |
| 10 | +import java.util.Collection; | |
| 11 | +import java.util.HashMap; | |
| 12 | +import java.util.List; | |
| 13 | +import java.util.Map; | |
| 14 | + | |
| 15 | +import org.apache.commons.io.IOUtils; | |
| 16 | +import org.apache.commons.lang3.StringEscapeUtils; | |
| 17 | +import org.joda.time.format.DateTimeFormat; | |
| 18 | +import org.joda.time.format.DateTimeFormatter; | |
| 19 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 20 | +import org.springframework.web.bind.annotation.PathVariable; | |
| 21 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 22 | +import org.springframework.web.bind.annotation.RequestMethod; | |
| 23 | +import org.springframework.web.bind.annotation.RequestParam; | |
| 24 | +import org.springframework.web.bind.annotation.RestController; | |
| 25 | + | |
| 26 | +import com.alibaba.fastjson.JSONArray; | |
| 27 | +import com.bsth.common.ResponseCode; | |
| 28 | +import com.bsth.controller.BaseController; | |
| 29 | +import com.bsth.controller.realcontrol.dto.ChangePersonCar; | |
| 30 | +import com.bsth.controller.realcontrol.dto.DfsjChange; | |
| 31 | +import com.bsth.data.BasicData; | |
| 32 | +import com.bsth.data.schedule.DayOfSchedule; | |
| 33 | +import com.bsth.data.schedule.edit_logs.service.dto.SchEditInfoDto; | |
| 34 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 35 | +import com.bsth.entity.schedule.SchedulePlanInfo; | |
| 36 | +import com.bsth.entity.sys.SysUser; | |
| 37 | +import com.bsth.security.util.SecurityUtils; | |
| 38 | +import com.bsth.service.realcontrol.ScheduleRealInfoService; | |
| 39 | +import com.bsth.util.ConfigUtil; | |
| 40 | +import com.fasterxml.jackson.databind.ObjectMapper; | |
| 41 | + | |
| 42 | +@RestController | |
| 43 | +@RequestMapping("/realSchedule") | |
| 44 | +public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> { | |
| 45 | + | |
| 46 | + @Autowired | |
| 47 | + ScheduleRealInfoService scheduleRealInfoService; | |
| 48 | + | |
| 49 | + @Autowired | |
| 50 | + DayOfSchedule dayOfSchedule; | |
| 51 | + | |
| 52 | + @RequestMapping(value = "check_fgs_ascription", method = RequestMethod.POST) | |
| 53 | + public Map<String, Object> checkPCFgsAscription(@RequestParam Long schId, String jGh, String sGh, String nbbm){ | |
| 54 | + return scheduleRealInfoService.checkPCFgsAscription(schId, jGh, sGh, nbbm); | |
| 55 | + } | |
| 56 | + | |
| 57 | + @RequestMapping(value = "/lines") | |
| 58 | + public Map<String, Collection<ScheduleRealInfo>> findByLines(@RequestParam String lines) { | |
| 59 | + return scheduleRealInfoService.findByLines(lines); | |
| 60 | + } | |
| 61 | + | |
| 62 | + @RequestMapping(value = "/car") | |
| 63 | + public List<ScheduleRealInfo> findByCar(String nbbm){ | |
| 64 | + return dayOfSchedule.findByNbbm(nbbm); | |
| 65 | + } | |
| 66 | + | |
| 67 | + /** | |
| 68 | + * | |
| 69 | + * @Title: outgoAdjust @Description: TODO(待发调整) @param @param id | |
| 70 | + * 主键 @param @param remarks 备注 @param @param dfsj 待发时间(HH:mm) @throws | |
| 71 | + */ | |
| 72 | + @RequestMapping(value = "/outgoAdjust", method = RequestMethod.POST) | |
| 73 | + public Map<String, Object> outgoAdjust(@RequestParam Long id, @RequestParam String remarks, | |
| 74 | + @RequestParam String dfsj,String bcType, | |
| 75 | + @RequestParam(defaultValue = "") String opType) { | |
| 76 | + return scheduleRealInfoService.outgoAdjust(id, remarks, dfsj, bcType, opType, null); | |
| 77 | + } | |
| 78 | + | |
| 79 | + /** | |
| 80 | + * | |
| 81 | + * @Title: destroy @Description: TODO(销毁,烂班) @param @param idsStr 要烂掉的班次ID ,分隔 | |
| 82 | + */ | |
| 83 | + @RequestMapping(value = "/destroy", method = RequestMethod.POST) | |
| 84 | + public Map<String, Object> destroy(@RequestParam String idsStr | |
| 85 | + /*, @RequestParam(defaultValue = "-1") int spaceAdjust*/, | |
| 86 | + @RequestParam String remarks, @RequestParam String adjustExps/*, @RequestParam(defaultValue = "0") int spaceNum*/) { | |
| 87 | + return scheduleRealInfoService.destroy(idsStr, remarks, adjustExps, null); | |
| 88 | + } | |
| 89 | + | |
| 90 | + /** | |
| 91 | + * | |
| 92 | + * @Title: carDeviceMapp @Description: TODO(获取车辆自编号和设备号对照,从缓存取) @throws | |
| 93 | + */ | |
| 94 | + @RequestMapping(value = "/carDeviceMapp", method = RequestMethod.GET) | |
| 95 | + public Map<String, String> carDeviceMapp() { | |
| 96 | + return BasicData.deviceId2NbbmMap.inverse(); | |
| 97 | + } | |
| 98 | + | |
| 99 | + /** | |
| 100 | + * | |
| 101 | + * @Title: findPersionByLine @Description: TODO(根据线路主键获取驾驶员) @param @param | |
| 102 | + * lineId @throws | |
| 103 | + */ | |
| 104 | + @RequestMapping(value = "/driver", method = RequestMethod.GET) | |
| 105 | + public List<Map<String, String>> findDriverByLine(@RequestParam String lineCode) { | |
| 106 | + return scheduleRealInfoService.findDriverByLine(lineCode); | |
| 107 | + } | |
| 108 | + | |
| 109 | + /** | |
| 110 | + * | |
| 111 | + * @Title: findPersionByLine @Description: TODO(根据线路主键获取售票员) @param @param | |
| 112 | + * lineId @throws | |
| 113 | + */ | |
| 114 | + @RequestMapping(value = "/conductor", method = RequestMethod.GET) | |
| 115 | + public List<Map<String, String>> findConductorByLine(@RequestParam String lineCode) { | |
| 116 | + return scheduleRealInfoService.findConductorByLine(lineCode); | |
| 117 | + } | |
| 118 | + | |
| 119 | + /** | |
| 120 | + * | |
| 121 | + * @Title: findPersionByLine @Description: TODO(根据线路主键获取车辆) @param @param | |
| 122 | + * lineId @throws | |
| 123 | + */ | |
| 124 | + @RequestMapping(value = "/cars", method = RequestMethod.GET) | |
| 125 | + public List<Map<String, String>> findCarByLine(@RequestParam String lineCode) { | |
| 126 | + return scheduleRealInfoService.findCarByLine(lineCode); | |
| 127 | + } | |
| 128 | + | |
| 129 | + /** | |
| 130 | + * | |
| 131 | + * @Title: sreachNbbm @Description: TODO(搜索车辆内部编码) @throws | |
| 132 | + */ | |
| 133 | + @RequestMapping(value = "/sreachVehic", method = RequestMethod.GET) | |
| 134 | + public List<Map<String, String>> sreachVehic(@RequestParam String nbbm) { | |
| 135 | + return scheduleRealInfoService.sreachVehic(nbbm); | |
| 136 | + } | |
| 137 | + /** | |
| 138 | + * | |
| 139 | + * @Title: realOutAdjust | |
| 140 | + * @Description: TODO(实发调整) | |
| 141 | + * @param @param id 班次ID | |
| 142 | + * @param @param fcsjActual 实际发车时间 HH:mm | |
| 143 | + * @param @param remarks 备注 | |
| 144 | + * @throws | |
| 145 | + */ | |
| 146 | + @RequestMapping(value = "/realOutAdjust", method = RequestMethod.POST) | |
| 147 | + public Map<String, Object> realOutAdjust(@RequestParam Long id, @RequestParam String fcsjActual, | |
| 148 | + @RequestParam String remarks) { | |
| 149 | + return scheduleRealInfoService.realOutAdjust(id, fcsjActual, remarks); | |
| 150 | + } | |
| 151 | + | |
| 152 | + /** | |
| 153 | + * | |
| 154 | + * @Title: revokeDestroy | |
| 155 | + * @Description: TODO(撤销烂班) | |
| 156 | + * @param @param id | |
| 157 | + * @throws | |
| 158 | + */ | |
| 159 | + @RequestMapping(value = "/revokeDestroy", method = RequestMethod.POST) | |
| 160 | + public Map<String, Object> revokeDestroy(@RequestParam Long id){ | |
| 161 | + return scheduleRealInfoService.revokeDestroy(id); | |
| 162 | + } | |
| 163 | + | |
| 164 | + /** | |
| 165 | + * | |
| 166 | + * @Title: revokeRealOutgo | |
| 167 | + * @Description: TODO(撤销实发) | |
| 168 | + * @param @param id | |
| 169 | + * @throws | |
| 170 | + */ | |
| 171 | + @RequestMapping(value = "/revokeRealOutgo", method = RequestMethod.POST) | |
| 172 | + public Map<String, Object> revokeRealOutgo(@RequestParam Long id){ | |
| 173 | + return scheduleRealInfoService.revokeRealOutgo(id); | |
| 174 | + } | |
| 175 | + | |
| 176 | + /** | |
| 177 | + * 撤销执行 | |
| 178 | + * @param id | |
| 179 | + * @return | |
| 180 | + */ | |
| 181 | + @RequestMapping(value = "/revokeRealArrive", method = RequestMethod.POST) | |
| 182 | + public Map<String, Object> revokeRealArrive(@RequestParam Long id){ | |
| 183 | + return scheduleRealInfoService.revokeRealArrive(id); | |
| 184 | + } | |
| 185 | + | |
| 186 | + /** | |
| 187 | + * | |
| 188 | + * @Title: spaceAdjust | |
| 189 | + * @Description: TODO(间隔调整) | |
| 190 | + * @param @param ids 要调整的班次数组ID | |
| 191 | + * @param @param space 间隔 | |
| 192 | + * @throws | |
| 193 | + */ | |
| 194 | + @RequestMapping(value = "/spaceAdjust", method = RequestMethod.POST) | |
| 195 | + public Map<String, Object> spaceAdjust(Long[] ids, Integer space){ | |
| 196 | + return scheduleRealInfoService.spaceAdjust(ids, space); | |
| 197 | + } | |
| 198 | + | |
| 199 | + /** | |
| 200 | + * | |
| 201 | + * @Title: schInfoFineTune | |
| 202 | + * @Description: TODO(发车信息微调) | |
| 203 | + * @param @param map | |
| 204 | + * @throws | |
| 205 | + */ | |
| 206 | + @RequestMapping(value = "/schInfoFineTune", method = RequestMethod.POST) | |
| 207 | + public Map<String, Object> schInfoFineTune(@RequestParam Map<String, String> map){ | |
| 208 | + return scheduleRealInfoService.schInfoFineTune(map); | |
| 209 | + } | |
| 210 | + | |
| 211 | + /** | |
| 212 | + * | |
| 213 | + * @Title: outgoAdjustAll | |
| 214 | + * @Description: TODO(批量待发调整) | |
| 215 | + * @param @param list | |
| 216 | + * @throws | |
| 217 | + */ | |
| 218 | + @RequestMapping(value = "/outgoAdjustAll", method = RequestMethod.POST) | |
| 219 | + public Map<String, Object> outgoAdjustAll(@RequestParam String params){ | |
| 220 | + //反转义 | |
| 221 | + params = StringEscapeUtils.unescapeHtml4(params); | |
| 222 | + return scheduleRealInfoService.outgoAdjustAll(params); | |
| 223 | + } | |
| 224 | + | |
| 225 | + /** | |
| 226 | + * | |
| 227 | + * @Title: findByLineAndUpDown | |
| 228 | + * @Description: TODO(根据线路和走向获取班次) | |
| 229 | + * @param @param line | |
| 230 | + * @param @param upDown | |
| 231 | + */ | |
| 232 | + @RequestMapping(value = "/findByLineAndUpDown") | |
| 233 | + public List<ScheduleRealInfo> findByLineAndUpDown(@RequestParam String line,@RequestParam Integer upDown){ | |
| 234 | + return dayOfSchedule.findByLineAndUpDown(line, upDown); | |
| 235 | + } | |
| 236 | + | |
| 237 | + /** | |
| 238 | + * | |
| 239 | + * @Title: findRouteByLine | |
| 240 | + * @Description: TODO(获取线路的站点,路段路由) | |
| 241 | + * @param @param lineCode | |
| 242 | + * @throws | |
| 243 | + */ | |
| 244 | + @RequestMapping(value = "/findRouteByLine") | |
| 245 | + public Map<String, Object> findRouteByLine(@RequestParam String lineCode){ | |
| 246 | + return scheduleRealInfoService.findRouteByLine(lineCode); | |
| 247 | + } | |
| 248 | + | |
| 249 | + /** | |
| 250 | + * | |
| 251 | + * @Title: removeChildTask | |
| 252 | + * @Description: TODO(删除子任务) | |
| 253 | + * @param @param taskId 子任务ID | |
| 254 | + * @throws | |
| 255 | + */ | |
| 256 | + @RequestMapping(value = "/childTask/{taskId}", method = RequestMethod.DELETE) | |
| 257 | + public Map<String, Object> removeChildTask(@PathVariable("taskId") Long taskId){ | |
| 258 | + return scheduleRealInfoService.removeChildTask(taskId); | |
| 259 | + } | |
| 260 | + | |
| 261 | + /** | |
| 262 | + * | |
| 263 | + * @Title: findByLineCode | |
| 264 | + * @Description: TODO(根据线路获取班次信息) | |
| 265 | + * @param @param lineCode | |
| 266 | + */ | |
| 267 | + @RequestMapping(value = "/lineCode/{lineCode}") | |
| 268 | + public List<ScheduleRealInfo> findByLineCode(@PathVariable("lineCode") String lineCode){ | |
| 269 | + return dayOfSchedule.findByLineCode(lineCode); | |
| 270 | + } | |
| 271 | + | |
| 272 | + @RequestMapping(value = "/queryUserInfo") | |
| 273 | + public List<ScheduleRealInfo> queryUserInfo(@RequestParam String line, | |
| 274 | + @RequestParam String date,@RequestParam String state) { | |
| 275 | + return scheduleRealInfoService.queryUserInfo(line, date,state); | |
| 276 | + } | |
| 277 | + | |
| 278 | + @RequestMapping(value = "/queryUserInfoPx") | |
| 279 | + public List<ScheduleRealInfo> queryUserInfoPx(@RequestParam String line, | |
| 280 | + @RequestParam String date,@RequestParam String state,@RequestParam String type) { | |
| 281 | + return scheduleRealInfoService.queryUserInfoPx(line, date,state,type); | |
| 282 | + } | |
| 283 | + | |
| 284 | + @RequestMapping(value = "/exportWaybill",method = RequestMethod.GET) | |
| 285 | + public List<ScheduleRealInfo> exportWaybill(@RequestParam String jName,@RequestParam String jGh, @RequestParam String clZbh, | |
| 286 | + @RequestParam String lpName,@RequestParam String date,@RequestParam String line) { | |
| 287 | + return scheduleRealInfoService.exportWaybill(jName,jGh, clZbh, lpName,date,line); | |
| 288 | + } | |
| 289 | + | |
| 290 | + @RequestMapping(value = "/exportWaybillQp",method = RequestMethod.GET) | |
| 291 | + public List<ScheduleRealInfo> exportWaybillQp(@RequestParam String clZbh | |
| 292 | + ,@RequestParam String date,@RequestParam String line) { | |
| 293 | + return scheduleRealInfoService.exportWaybillQp( clZbh, date,line); | |
| 294 | + } | |
| 295 | + | |
| 296 | + | |
| 297 | + @RequestMapping(value = "/dailyInfo") | |
| 298 | + public List<Map<String, Object>> dailyInfo(@RequestParam String line, @RequestParam String date,@RequestParam String type) { | |
| 299 | + return scheduleRealInfoService.dailyInfo(line, date, type); | |
| 300 | + } | |
| 301 | + | |
| 302 | + @RequestMapping(value = "/historyMessage") | |
| 303 | + public List<Object[]> historyMessage(@RequestParam String line, @RequestParam String date, | |
| 304 | + @RequestParam String code, @RequestParam String type) { | |
| 305 | + return scheduleRealInfoService.historyMessage(line, date, code, type); | |
| 306 | + } | |
| 307 | + | |
| 308 | + @RequestMapping(value="/findLine") | |
| 309 | + public List<Map<String,String>> findLine(@RequestParam String line){ | |
| 310 | + return scheduleRealInfoService.findLine(line); | |
| 311 | + } | |
| 312 | + | |
| 313 | + @RequestMapping(value="/findKMBC",method = RequestMethod.GET) | |
| 314 | + public Map<String,Object> findKMBC(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | |
| 315 | + ,@RequestParam String date,@RequestParam String line){ | |
| 316 | + return scheduleRealInfoService.findKMBC(jGh, clZbh,lpName,date,line); | |
| 317 | + } | |
| 318 | + | |
| 319 | + /** | |
| 320 | + * 路单公里统计 (闵行审计专用) | |
| 321 | + * @param jGh | |
| 322 | + * @param clZbh | |
| 323 | + * @param lpName | |
| 324 | + * @param date | |
| 325 | + * @param line | |
| 326 | + * @return | |
| 327 | + */ | |
| 328 | + @RequestMapping(value="/findKMBC_mh_2",method = RequestMethod.GET) | |
| 329 | + public Map<String,Object> findKMBC_mh_2(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | |
| 330 | + ,@RequestParam String date,@RequestParam String line){ | |
| 331 | + return scheduleRealInfoService.findKMBC_mh_2(jGh, clZbh,lpName,date,line); | |
| 332 | + } | |
| 333 | + | |
| 334 | + @RequestMapping(value="/findKMBCQp",method = RequestMethod.GET) | |
| 335 | + public Map<String,Object> findKMBCQp(@RequestParam String clZbh | |
| 336 | + ,@RequestParam String date,@RequestParam String line){ | |
| 337 | + return scheduleRealInfoService.findKMBCQp(clZbh,date,line); | |
| 338 | + } | |
| 339 | + | |
| 340 | + @RequestMapping(value="/findLpName") | |
| 341 | + public List<Map<String,String>> findLpName(@RequestParam String lpName){ | |
| 342 | + return scheduleRealInfoService.findLpName(lpName); | |
| 343 | + } | |
| 344 | + | |
| 345 | + @RequestMapping(value = "/account") | |
| 346 | + public List<Map<String,Object>> account(@RequestParam String line, @RequestParam String date, | |
| 347 | + @RequestParam String code,@RequestParam String xlName, @RequestParam String type) { | |
| 348 | + return scheduleRealInfoService.account(line, date, code, xlName, type); | |
| 349 | + } | |
| 350 | + | |
| 351 | + @RequestMapping(value = "/accountPx") | |
| 352 | + public List<Map<String,Object>> accountPx(@RequestParam String line, @RequestParam String date, | |
| 353 | + @RequestParam String code,@RequestParam String xlName, @RequestParam String px) { | |
| 354 | + return scheduleRealInfoService.accountPx(line, date, code, xlName, px); | |
| 355 | + } | |
| 356 | + | |
| 357 | + @RequestMapping(value = "/correctForm") | |
| 358 | + public List<SchEditInfoDto> correctForm(@RequestParam String line, @RequestParam String date, | |
| 359 | + @RequestParam String endDate, | |
| 360 | + @RequestParam String lpName, @RequestParam String code, | |
| 361 | + @RequestParam String type,@RequestParam String changType) { | |
| 362 | + return scheduleRealInfoService.correctForm(line, date, endDate, lpName, code, type,changType); | |
| 363 | + } | |
| 364 | + /** | |
| 365 | + * @Title queryListWaybill | |
| 366 | + * @Description 查询行车路单列表 | |
| 367 | + * @param jName 驾驶员名字 | |
| 368 | + * @param clZbh 车辆自编号(内部编号) | |
| 369 | + * @param lpName 路牌 | |
| 370 | + * @return | |
| 371 | + */ | |
| 372 | + @RequestMapping(value="/queryListWaybill",method = RequestMethod.GET) | |
| 373 | + public List<ScheduleRealInfo> queryListWaybill(@RequestParam String jGh,@RequestParam String clZbh,@RequestParam String lpName | |
| 374 | + ,@RequestParam String date,@RequestParam String line){ | |
| 375 | + return scheduleRealInfoService.queryListWaybill(jGh, clZbh,lpName,date,line); | |
| 376 | + } | |
| 377 | + | |
| 378 | + /** | |
| 379 | + * @Title queryListWaybill | |
| 380 | + * @Description 查询行车路单列表(闵行审计专用路单) | |
| 381 | + * @param jName 驾驶员名字 | |
| 382 | + * @param clZbh 车辆自编号(内部编号) | |
| 383 | + * @param lpName 路牌 | |
| 384 | + * @return | |
| 385 | + */ | |
| 386 | + @RequestMapping(value="/queryListWaybill_mh_2",method = RequestMethod.GET) | |
| 387 | + public List<ScheduleRealInfo> queryListWaybill_mh_2(@RequestParam String jName,@RequestParam String clZbh,@RequestParam String lpName | |
| 388 | + ,@RequestParam String date,@RequestParam String line){ | |
| 389 | + return scheduleRealInfoService.queryListWaybill2(jName, clZbh,lpName,date,line); | |
| 390 | + } | |
| 391 | + | |
| 392 | + @RequestMapping(value="/queryListWaybillQp",method = RequestMethod.GET) | |
| 393 | + public List<ScheduleRealInfo> queryListWaybillQp(@RequestParam String clZbh, | |
| 394 | + @RequestParam String date,@RequestParam String line){ | |
| 395 | + return scheduleRealInfoService.queryListWaybillQp(clZbh,date,line); | |
| 396 | + } | |
| 397 | + | |
| 398 | + @RequestMapping(value="/statisticsDaily") | |
| 399 | + public List<Map<String,Object>> statisticsDaily(@RequestParam String line, @RequestParam String date, | |
| 400 | + @RequestParam String xlName, @RequestParam String type){ | |
| 401 | + return scheduleRealInfoService.statisticsDaily(line, date, xlName, type); | |
| 402 | + } | |
| 403 | + | |
| 404 | + @RequestMapping(value="/statisticsDaily_mh_2") | |
| 405 | + public List<Map<String,Object>> statisticsDaily_mh_2(@RequestParam String line, @RequestParam String date, | |
| 406 | + @RequestParam String xlName, @RequestParam String type){ | |
| 407 | + return scheduleRealInfoService.statisticsDaily_mh_2(line, date, xlName, type); | |
| 408 | + } | |
| 409 | + | |
| 410 | + @RequestMapping(value="/statisticsDailyTj") | |
| 411 | + public List<Map<String,Object>> statisticsDailyTj(@RequestParam Map<String, Object> map){ | |
| 412 | + String gsdm=""; | |
| 413 | + if(map.get("gsdm")!=null){ | |
| 414 | + gsdm=map.get("gsdm").toString(); | |
| 415 | + } | |
| 416 | + String fgsdm=""; | |
| 417 | + if(map.get("fgsdm")!=null){ | |
| 418 | + fgsdm=map.get("fgsdm").toString(); | |
| 419 | + } | |
| 420 | + String line=""; | |
| 421 | + if(map.get("line")!=null){ | |
| 422 | + line=map.get("line").toString(); | |
| 423 | + } | |
| 424 | + String date=""; | |
| 425 | + if(map.get("date")!=null){ | |
| 426 | + date=map.get("date").toString(); | |
| 427 | + } | |
| 428 | + String date2=""; | |
| 429 | + if(map.get("date2")!=null){ | |
| 430 | + date2=map.get("date2").toString(); | |
| 431 | + } | |
| 432 | + String xlName=""; | |
| 433 | + if(map.get("xlName")!=null){ | |
| 434 | + xlName=map.get("xlName").toString(); | |
| 435 | + } | |
| 436 | + String type=""; | |
| 437 | + if(map.get("type")!=null){ | |
| 438 | + type=map.get("type").toString(); | |
| 439 | + } | |
| 440 | + String nature="0"; | |
| 441 | + if(map.get("nature")!=null){ | |
| 442 | + nature=map.get("nature").toString(); | |
| 443 | + } | |
| 444 | + return scheduleRealInfoService.statisticsDailyTj(gsdm,fgsdm,line, date,date2, xlName, type,nature); | |
| 445 | + } | |
| 446 | + | |
| 447 | + /* | |
| 448 | + * 公里修正报表 | |
| 449 | + */ | |
| 450 | + @RequestMapping(value="/mileageReportTj") | |
| 451 | + public List<Map<String,Object>> mileageReport(@RequestParam Map<String, Object> map){ | |
| 452 | + String gsdm=""; | |
| 453 | + if(map.get("gsdm")!=null){ | |
| 454 | + gsdm=map.get("gsdm").toString(); | |
| 455 | + } | |
| 456 | + String fgsdm=""; | |
| 457 | + if(map.get("fgsdm")!=null){ | |
| 458 | + fgsdm=map.get("fgsdm").toString(); | |
| 459 | + } | |
| 460 | + String line=""; | |
| 461 | + if(map.get("line")!=null){ | |
| 462 | + line=map.get("line").toString(); | |
| 463 | + } | |
| 464 | + String date=""; | |
| 465 | + if(map.get("date")!=null){ | |
| 466 | + date=map.get("date").toString(); | |
| 467 | + } | |
| 468 | + String date2=""; | |
| 469 | + if(map.get("date2")!=null){ | |
| 470 | + date2=map.get("date2").toString(); | |
| 471 | + } | |
| 472 | + String xlName=""; | |
| 473 | + if(map.get("xlName")!=null){ | |
| 474 | + xlName=map.get("xlName").toString(); | |
| 475 | + } | |
| 476 | + return scheduleRealInfoService.mileageReport(gsdm,fgsdm,line, date,date2); | |
| 477 | + } | |
| 478 | + | |
| 479 | + /* | |
| 480 | + * 班次修正报表 | |
| 481 | + */ | |
| 482 | + @RequestMapping(value="/scheduleCorrectionReport") | |
| 483 | + public List<Map<String,Object>> scheduleCorrectionReport(@RequestParam Map<String, Object> map){ | |
| 484 | + String gsdm=""; | |
| 485 | + if(map.get("gsdm")!=null){ | |
| 486 | + gsdm=map.get("gsdm").toString(); | |
| 487 | + } | |
| 488 | + String fgsdm=""; | |
| 489 | + if(map.get("fgsdm")!=null){ | |
| 490 | + fgsdm=map.get("fgsdm").toString(); | |
| 491 | + } | |
| 492 | + String line=""; | |
| 493 | + if(map.get("line")!=null){ | |
| 494 | + line=map.get("line").toString(); | |
| 495 | + } | |
| 496 | + String date=""; | |
| 497 | + if(map.get("date")!=null){ | |
| 498 | + date=map.get("date").toString(); | |
| 499 | + } | |
| 500 | + String date2=""; | |
| 501 | + if(map.get("date2")!=null){ | |
| 502 | + date2=map.get("date2").toString(); | |
| 503 | + } | |
| 504 | + String xlName=""; | |
| 505 | + if(map.get("xlName")!=null){ | |
| 506 | + xlName=map.get("xlName").toString(); | |
| 507 | + } | |
| 508 | + return scheduleRealInfoService.scheduleCorrectionReport(gsdm,fgsdm,line, date,date2); | |
| 509 | + } | |
| 510 | + | |
| 511 | + @RequestMapping(value="/MapById",method = RequestMethod.GET) | |
| 512 | + public Map<String, Object> MapById(@RequestParam("id") Long id){ | |
| 513 | + return scheduleRealInfoService.MapById(id); | |
| 514 | + } | |
| 515 | + | |
| 516 | + @RequestMapping(value="/MapByIdQp",method = RequestMethod.GET) | |
| 517 | + public Map<String, Object> MapByIdQp(@RequestParam("id") Long id){ | |
| 518 | + return scheduleRealInfoService.MapByIdQp(id); | |
| 519 | + } | |
| 520 | + | |
| 521 | + /** | |
| 522 | + * @Title: scheduleDaily | |
| 523 | + * @Description: TODO(调度日报表) | |
| 524 | + * @param line 线路 | |
| 525 | + * @param date 时间 | |
| 526 | + * @return | |
| 527 | + */ | |
| 528 | + @RequestMapping(value="/scheduleDaily") | |
| 529 | + public Map<String,Object> scheduleDaily(@RequestParam String line,@RequestParam String date){ | |
| 530 | + return scheduleRealInfoService.scheduleDaily(line,date); | |
| 531 | + } | |
| 532 | + | |
| 533 | + @RequestMapping(value="/realScheduleList") | |
| 534 | + public List<ScheduleRealInfo> realScheduleList(@RequestParam String line,@RequestParam String date){ | |
| 535 | + return scheduleRealInfoService.realScheduleList(line,date); | |
| 536 | + } | |
| 537 | + | |
| 538 | + @RequestMapping(value="/realScheduleList_zrw") | |
| 539 | + public List<ScheduleRealInfo> realScheduleList_zrw(@RequestParam String line,@RequestParam String date){ | |
| 540 | + return scheduleRealInfoService.realScheduleList_zrw(line,date); | |
| 541 | + } | |
| 542 | + | |
| 543 | + @RequestMapping(value="/realScheduleList_mh_2") | |
| 544 | + public List<ScheduleRealInfo> realScheduleList_mh_2(@RequestParam String line,@RequestParam String date){ | |
| 545 | + return scheduleRealInfoService.realScheduleList_mh_2(line,date); | |
| 546 | + } | |
| 547 | + | |
| 548 | + @RequestMapping(value="/realScheduleListQp") | |
| 549 | + public List<ScheduleRealInfo> realScheduleListQp(@RequestParam String line,@RequestParam String date){ | |
| 550 | + return scheduleRealInfoService.realScheduleListQp(line,date); | |
| 551 | + } | |
| 552 | + | |
| 553 | + @RequestMapping(value="/multi_tzrc", method=RequestMethod.POST) | |
| 554 | + public Map<String, Object> multi_tzrc(@RequestParam String cpcsJson){ | |
| 555 | + cpcsJson = StringEscapeUtils.unescapeHtml4(cpcsJson); | |
| 556 | + List<ChangePersonCar> cpcs = JSONArray.parseArray(cpcsJson, ChangePersonCar.class); | |
| 557 | + return scheduleRealInfoService.multi_tzrc(cpcs, null); | |
| 558 | + } | |
| 559 | + | |
| 560 | + @RequestMapping(value="/multi_dftz", method=RequestMethod.POST) | |
| 561 | + public Map<String, Object> multi_dftz(@RequestParam String dcsJson){ | |
| 562 | + dcsJson = StringEscapeUtils.unescapeHtml4(dcsJson); | |
| 563 | + List<DfsjChange> dfsjcs = JSONArray.parseArray(dcsJson, DfsjChange.class); | |
| 564 | + return scheduleRealInfoService.multi_dftz(dfsjcs); | |
| 565 | + } | |
| 566 | + | |
| 567 | + @RequestMapping(value="/changeBcType/{id}", method=RequestMethod.POST) | |
| 568 | + public Map<String, Object> changeBcType(@PathVariable("id") Long id, String bcType, String remarks, String majorStationName){ | |
| 569 | + return scheduleRealInfoService.changeBcType(id, bcType, remarks, majorStationName); | |
| 570 | + } | |
| 571 | + | |
| 572 | + @RequestMapping(value="/history", method=RequestMethod.POST) | |
| 573 | + public Map<String,Object> historySave(ScheduleRealInfo sch){ | |
| 574 | + return scheduleRealInfoService.historySave(sch); | |
| 575 | + } | |
| 576 | + | |
| 577 | + | |
| 578 | + private static DateTimeFormatter fmtyyyyMMdd = DateTimeFormat.forPattern("yyyy-MM-dd"); | |
| 579 | + private final static long ONE_DAY = 1000 * 60 * 60 * 24; | |
| 580 | + /** | |
| 581 | + * 获取可编辑的历史班次日期 | |
| 582 | + * @return | |
| 583 | + */ | |
| 584 | + @RequestMapping("dateArray") | |
| 585 | + public List<String> dateArray(@RequestParam(defaultValue = "0") int c){ | |
| 586 | + List<String> rs = new ArrayList<>(); | |
| 587 | + | |
| 588 | + long t = System.currentTimeMillis(); | |
| 589 | + if(c != 1) | |
| 590 | + t -= (ONE_DAY + (1000 * 60 * 60 * 6)); | |
| 591 | + for(int i = 0; i < 10; i ++){ | |
| 592 | + rs.add(fmtyyyyMMdd.print(t)); | |
| 593 | + t -= ONE_DAY; | |
| 594 | + } | |
| 595 | + return rs; | |
| 596 | + } | |
| 597 | + | |
| 598 | + @RequestMapping(value = "svgAttr", method = RequestMethod.POST) | |
| 599 | + public Map<String, Object> svgAttr(@RequestParam String jsonStr){ | |
| 600 | + return scheduleRealInfoService.svgAttr(jsonStr); | |
| 601 | + } | |
| 602 | + | |
| 603 | + @RequestMapping(value = "svgAttr", method = RequestMethod.GET) | |
| 604 | + public Map<String, Object> findSvgAttr(@RequestParam String idx){ | |
| 605 | + return scheduleRealInfoService.findSvgAttr(idx); | |
| 606 | + } | |
| 607 | + | |
| 608 | + @RequestMapping(value = "addRemarks", method = RequestMethod.POST) | |
| 609 | + public Map<String, Object> addRemarks(@RequestParam Long id, @RequestParam String remarks){ | |
| 610 | + return scheduleRealInfoService.addRemarks(id, remarks); | |
| 611 | + } | |
| 612 | + | |
| 613 | + @RequestMapping(value = "scheduleDailyQp", method = RequestMethod.GET) | |
| 614 | + public List<Map<String, Object>> scheduleDailyQp(@RequestParam String line,@RequestParam String date){ | |
| 615 | + return scheduleRealInfoService.scheduleDailyQp(line,date); | |
| 616 | + } | |
| 617 | + | |
| 618 | + @RequestMapping(value = "scheduleDailyExport", method = RequestMethod.GET) | |
| 619 | + public List<Map<String, Object>> scheduleDailyExport(@RequestParam Map<String, Object> map){ | |
| 620 | + return scheduleRealInfoService.scheduleDailyExport(map); | |
| 621 | + } | |
| 622 | + | |
| 623 | + @RequestMapping(value = "exportWaybillMore", method = RequestMethod.GET) | |
| 624 | + public Map<String, Object> exportWaybillMore(@RequestParam Map<String, Object> map){ | |
| 625 | + return scheduleRealInfoService.exportWaybillMore(map); | |
| 626 | + } | |
| 627 | + | |
| 628 | + /** | |
| 629 | + * 获取当日计划排班 , 从计划表抓取数据 | |
| 630 | + * @return | |
| 631 | + */ | |
| 632 | + @RequestMapping(value = "currSchedulePlanByLineCode", method = RequestMethod.GET) | |
| 633 | + public List<SchedulePlanInfo> currentSchedulePlan(@RequestParam String lineCode){ | |
| 634 | + return scheduleRealInfoService.currentSchedulePlan(lineCode); | |
| 635 | + } | |
| 636 | + | |
| 637 | + @RequestMapping(value = "lpChangeMulti", method = RequestMethod.POST) | |
| 638 | + public Map<String, Object> lpChangeMulti(@RequestParam String leftIdx, @RequestParam String rightIdx,@RequestParam int type){ | |
| 639 | + return scheduleRealInfoService.lpChangeMulti(leftIdx, rightIdx, type); | |
| 640 | + } | |
| 641 | + | |
| 642 | + /** | |
| 643 | + * 删除当日实际排班 | |
| 644 | + * @return | |
| 645 | + */ | |
| 646 | + @RequestMapping(value = "deleteRealSchedule", method = RequestMethod.POST) | |
| 647 | + public Map<String, Object> deleteRealSchedule(@RequestParam String lineCode){ | |
| 648 | + return dayOfSchedule.deleteRealSchedule(lineCode); | |
| 649 | + } | |
| 650 | + | |
| 651 | + /** | |
| 652 | + * 从计划表重新加载当日排班 | |
| 653 | + * @param lineCode | |
| 654 | + * @return | |
| 655 | + */ | |
| 656 | + @RequestMapping(value = "reLoadRealSchedule", method = RequestMethod.POST) | |
| 657 | + public Map<String, Object> reLoadRealSchedule(@RequestParam String lineCode){ | |
| 658 | + Map<String, Object> rs = new HashMap<>(); | |
| 659 | + List<ScheduleRealInfo> list = dayOfSchedule.findByLineCode(lineCode); | |
| 660 | + if(list != null && list.size() > 0){ | |
| 661 | + rs.put("status", ResponseCode.ERROR); | |
| 662 | + rs.put("msg", "失败," + list.get(0).getXlName() + "当日存在实际排班,无法重新加载。"); | |
| 663 | + return rs; | |
| 664 | + } | |
| 665 | + | |
| 666 | + int code = dayOfSchedule.reloadSch(lineCode); | |
| 667 | + | |
| 668 | + //重新按公司编码索引数据 | |
| 669 | + dayOfSchedule.groupByGsbm(); | |
| 670 | + rs.put("status", code==0? ResponseCode.SUCCESS: ResponseCode.ERROR); | |
| 671 | + return rs; | |
| 672 | + } | |
| 673 | + | |
| 674 | + /** | |
| 675 | + * 误点调整 | |
| 676 | + * @param idx | |
| 677 | + * @param minute | |
| 678 | + * @return | |
| 679 | + */ | |
| 680 | + @RequestMapping(value = "lateAdjust", method = RequestMethod.POST) | |
| 681 | + public Map<String, Object> lateAdjust(@RequestParam String idx,@RequestParam float minute ){ | |
| 682 | + return scheduleRealInfoService.lateAdjust(idx, minute); | |
| 683 | + } | |
| 684 | + | |
| 685 | + /** | |
| 686 | + * 获取所有应发未到的班次 | |
| 687 | + * @param idx | |
| 688 | + * @return | |
| 689 | + */ | |
| 690 | + @RequestMapping(value = "allLate2") | |
| 691 | + public List<ScheduleRealInfo> allLate2(@RequestParam String idx){ | |
| 692 | + return scheduleRealInfoService.allLate2(idx); | |
| 693 | + } | |
| 694 | + | |
| 695 | + /** | |
| 696 | + * 添加一个临加到历史库 | |
| 697 | + * @param sch | |
| 698 | + * @return | |
| 699 | + */ | |
| 700 | + @RequestMapping(value = "history/add", method = RequestMethod.POST) | |
| 701 | + public Map<String, Object> addToHistory(ScheduleRealInfo sch){ | |
| 702 | + return scheduleRealInfoService.addToHistory(sch); | |
| 703 | + } | |
| 704 | + | |
| 705 | + /** | |
| 706 | + * 从历史库里删除临加班次 | |
| 707 | + * @param sch | |
| 708 | + * @return | |
| 709 | + */ | |
| 710 | + @RequestMapping(value = "history/{id}", method = RequestMethod.DELETE) | |
| 711 | + public Map<String, Object> deleteToHistory(@PathVariable("id") Long id){ | |
| 712 | + return scheduleRealInfoService.deleteToHistory(id); | |
| 713 | + } | |
| 714 | + | |
| 715 | + @RequestMapping(value = "isCircleQdz", method = RequestMethod.POST) | |
| 716 | + public Map<String, Object> isCircleQdz(@RequestParam String line, String nbbm, String ts, String qdzCode){ | |
| 717 | + Map<String, Object> map =new HashMap<>(); | |
| 718 | + map.put("isExist",scheduleRealInfoService.isCircleQdz(nbbm, ts, line, qdzCode)); | |
| 719 | + return map; | |
| 720 | + } | |
| 721 | + | |
| 722 | + /** | |
| 723 | + * 从历史库里删除临加班次 | |
| 724 | + * @param sch | |
| 725 | + * @return | |
| 726 | + */ | |
| 727 | + @RequestMapping(value = "wxsb", method = RequestMethod.POST) | |
| 728 | + public Map<String, Object> deleteToHistory(@RequestParam Map<String, Object> param){ | |
| 729 | + SysUser user = SecurityUtils.getCurrentUser(); | |
| 730 | + String uname = user.getUserName(); | |
| 731 | + StringBuilder url = new StringBuilder(ConfigUtil.get("http.report.url")); | |
| 732 | + url.append("?nbbm=").append(param.get("nbbm")).append("&bxy=").append(uname).append("&bxbm=").append(param.get("bxType")); | |
| 733 | + // 分公司保存格式 分公司编码_公司编码 | |
| 734 | + String val = BasicData.nbbm2FgsCompanyCodeMap.get(param.get("nbbm")); | |
| 735 | + String[] arr = val.split("_"); | |
| 736 | + if (!"22".equals(arr[1])) { | |
| 737 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 738 | + res.put("status", ResponseCode.ERROR); | |
| 739 | + res.put("msg", "除金高公司外暂未开通此功能"); | |
| 740 | + | |
| 741 | + return res; | |
| 742 | + } | |
| 743 | + url.append("&fgs=").append(arr[0]); | |
| 744 | + | |
| 745 | + return request(url.toString()); | |
| 746 | + } | |
| 747 | + | |
| 748 | + @SuppressWarnings("unchecked") | |
| 749 | + private static Map<String, Object> request(String url) { | |
| 750 | + Map<String, Object> res = new HashMap<String, Object>(); | |
| 751 | + res.put("status", ResponseCode.SUCCESS); | |
| 752 | + InputStream in = null; | |
| 753 | + HttpURLConnection con = null; | |
| 754 | + try { | |
| 755 | + con = (HttpURLConnection)new URL(url).openConnection(); | |
| 756 | + con.setRequestMethod("POST"); | |
| 757 | + con.setRequestProperty("keep-alive", "true"); | |
| 758 | + con.setRequestProperty("accept", "application/json"); | |
| 759 | + con.setRequestProperty("content-type", "application/json"); | |
| 760 | + con.setDoInput(true); | |
| 761 | + con.setReadTimeout(2500); | |
| 762 | + con.setConnectTimeout(2500); | |
| 763 | + | |
| 764 | + con.connect(); | |
| 765 | + if (con.getResponseCode() == 200) { | |
| 766 | + in = con.getInputStream(); | |
| 767 | + ByteArrayOutputStream bout = new ByteArrayOutputStream(); | |
| 768 | + IOUtils.copy(in, bout); bout.close(); | |
| 769 | + Map<String, Object> response = new ObjectMapper().readValue(bout.toByteArray(), Map.class); | |
| 770 | + if (!"报修成功".equals(response.get("msg"))) { | |
| 771 | + res.put("status", ResponseCode.ERROR); | |
| 772 | + res.putAll(response); | |
| 773 | + } | |
| 774 | + } | |
| 775 | + } catch (IOException e) { | |
| 776 | + // TODO Auto-generated catch block | |
| 777 | + res.put("status", ResponseCode.ERROR); | |
| 778 | + res.put("msg", "调用上报接口异常"); | |
| 779 | + } finally { | |
| 780 | + try { | |
| 781 | + if (in != null) in.close(); | |
| 782 | + if (con != null) con.disconnect(); | |
| 783 | + } catch (IOException e) { | |
| 784 | + // TODO Auto-generated catch block | |
| 785 | + e.printStackTrace(); | |
| 786 | + } | |
| 787 | + } | |
| 788 | + | |
| 789 | + return res; | |
| 790 | + } | |
| 791 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
| 1 | -package com.bsth.data.gpsdata_v2; | |
| 2 | - | |
| 3 | -import com.alibaba.fastjson.JSON; | |
| 4 | -import com.bsth.data.gpsdata_v2.cache.GpsCacheData; | |
| 5 | -import com.bsth.data.gpsdata_v2.entity.GpsEntity; | |
| 6 | -import com.bsth.data.gpsdata_v2.handlers.*; | |
| 7 | -import com.google.common.collect.ArrayListMultimap; | |
| 8 | -import org.apache.commons.lang3.StringUtils; | |
| 9 | -import org.slf4j.Logger; | |
| 10 | -import org.slf4j.LoggerFactory; | |
| 11 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | -import org.springframework.stereotype.Component; | |
| 13 | - | |
| 14 | -import java.util.*; | |
| 15 | -import java.util.concurrent.CountDownLatch; | |
| 16 | -import java.util.concurrent.ExecutorService; | |
| 17 | -import java.util.concurrent.Executors; | |
| 18 | - | |
| 19 | -/** | |
| 20 | - * 实时信号数据处理 | |
| 21 | - * Created by panzhao on 2017/11/15. | |
| 22 | - */ | |
| 23 | -@Component | |
| 24 | -public class DataHandleProcess { | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - GpsStateProcess gpsStateProcess; | |
| 28 | - @Autowired | |
| 29 | - StationInsideProcess stationInsideProcess; | |
| 30 | - @Autowired | |
| 31 | - AbnormalStateProcess abnormalStateProcess; | |
| 32 | - @Autowired | |
| 33 | - InStationProcess inStationProcess; | |
| 34 | - @Autowired | |
| 35 | - OutStationProcess outStationProcess; | |
| 36 | - @Autowired | |
| 37 | - ReverseRouteProcess reverseRouteProcess; | |
| 38 | - @Autowired | |
| 39 | - GpsRealData gpsRealData; | |
| 40 | - | |
| 41 | - | |
| 42 | - static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); | |
| 43 | - | |
| 44 | - final static int POOL_SIZE = 9; | |
| 45 | - | |
| 46 | - static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); | |
| 47 | - public static CountDownLatch count; | |
| 48 | - | |
| 49 | - static long lastTime; | |
| 50 | - | |
| 51 | - public static boolean isBlock() { | |
| 52 | - return System.currentTimeMillis() - lastTime > 1000 * 30; | |
| 53 | - } | |
| 54 | - | |
| 55 | - public void handle(List<GpsEntity> list) { | |
| 56 | - try { | |
| 57 | - if (list.size() == 0) | |
| 58 | - return; | |
| 59 | - lastTime = System.currentTimeMillis(); | |
| 60 | - //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑) | |
| 61 | - ArrayListMultimap multimap = ArrayListMultimap.create(); | |
| 62 | - for (GpsEntity gps : list) { | |
| 63 | - multimap.put(gps.getDeviceId(), gps); | |
| 64 | - } | |
| 65 | - List<String> deviceList = new ArrayList<>(multimap.keySet()); | |
| 66 | - | |
| 67 | - //数据均分给线程 | |
| 68 | - ArrayListMultimap dataListMap = ArrayListMultimap.create(); | |
| 69 | - int size = deviceList.size(), threadIndex = 0, threadSize = size / POOL_SIZE; | |
| 70 | - if(threadSize==0) | |
| 71 | - threadSize = size; | |
| 72 | - for (int i = 0; i < size; i++) { | |
| 73 | - if (i % threadSize == 0) | |
| 74 | - threadIndex++; | |
| 75 | - dataListMap.putAll(threadIndex, multimap.get(deviceList.get(i))); | |
| 76 | - } | |
| 77 | - Set<Integer> ks = dataListMap.keySet(); | |
| 78 | - logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); | |
| 79 | - count = new CountDownLatch(ks.size()); | |
| 80 | - | |
| 81 | - logger.info(JSON.toJSONString(ks)); | |
| 82 | - for (Integer index : ks) { | |
| 83 | - threadPool.execute(new SignalHandleThread(dataListMap.get(index), count)); | |
| 84 | - } | |
| 85 | - | |
| 86 | - | |
| 87 | - //等待子线程结束 | |
| 88 | - count.await(); | |
| 89 | - | |
| 90 | - //加入实时gps对照 | |
| 91 | - for (GpsEntity gps : list) | |
| 92 | - gpsRealData.put(gps); | |
| 93 | - | |
| 94 | - logger.info("time , " + (System.currentTimeMillis() - lastTime)); | |
| 95 | - } catch (Exception e) { | |
| 96 | - logger.error("", e); | |
| 97 | - } | |
| 98 | - } | |
| 99 | - | |
| 100 | - static GpsComp comp = new GpsComp(); | |
| 101 | - | |
| 102 | - public class SignalHandleThread implements Runnable { | |
| 103 | - | |
| 104 | - List<GpsEntity> list; | |
| 105 | - CountDownLatch count; | |
| 106 | - | |
| 107 | - SignalHandleThread(List<GpsEntity> gpsList, CountDownLatch count) { | |
| 108 | - this.list = gpsList; | |
| 109 | - this.count = count; | |
| 110 | - } | |
| 111 | - | |
| 112 | - @Override | |
| 113 | - public void run() { | |
| 114 | - try { | |
| 115 | - Collections.sort(list, comp); | |
| 116 | - GpsEntity gps; | |
| 117 | - for(int i = 0,len = list.size(); i< len ;i ++){ | |
| 118 | - gps = list.get(i); | |
| 119 | - | |
| 120 | - try { | |
| 121 | - if (StringUtils.isEmpty(gps.getNbbm())) | |
| 122 | - continue; | |
| 123 | - if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20) | |
| 124 | - continue; | |
| 125 | - | |
| 126 | - gpsStateProcess.process(gps);//状态处理 | |
| 127 | - stationInsideProcess.process(gps);//场站内外判定 | |
| 128 | - reverseRouteProcess.process(gps);//反向路由处理 | |
| 129 | - abnormalStateProcess.process(gps);//超速越界 | |
| 130 | - | |
| 131 | - inStationProcess.process(gps);//进站 | |
| 132 | - outStationProcess.process(gps);//出站 | |
| 133 | - | |
| 134 | - | |
| 135 | - GpsCacheData.putGps(gps);//历史gps缓存 | |
| 136 | - } catch (Throwable e) { | |
| 137 | - logger.error("", e); | |
| 138 | - } | |
| 139 | - } | |
| 140 | - } finally { | |
| 141 | - if (count != null) | |
| 142 | - count.countDown(); | |
| 143 | - } | |
| 144 | - } | |
| 145 | - } | |
| 146 | - | |
| 147 | - public static class GpsComp implements Comparator<GpsEntity> { | |
| 148 | - | |
| 149 | - @Override | |
| 150 | - public int compare(GpsEntity g1, GpsEntity g2) { | |
| 151 | - return g1.getTimestamp().compareTo(g2.getTimestamp()); | |
| 152 | - } | |
| 153 | - } | |
| 1 | +package com.bsth.data.gpsdata_v2; | |
| 2 | + | |
| 3 | +import com.alibaba.fastjson.JSON; | |
| 4 | +import com.bsth.data.gpsdata_v2.cache.GpsCacheData; | |
| 5 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | |
| 6 | +import com.bsth.data.gpsdata_v2.handlers.*; | |
| 7 | +import com.google.common.collect.ArrayListMultimap; | |
| 8 | +import org.apache.commons.lang3.StringUtils; | |
| 9 | +import org.slf4j.Logger; | |
| 10 | +import org.slf4j.LoggerFactory; | |
| 11 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 12 | +import org.springframework.stereotype.Component; | |
| 13 | + | |
| 14 | +import java.util.*; | |
| 15 | +import java.util.concurrent.CountDownLatch; | |
| 16 | +import java.util.concurrent.ExecutorService; | |
| 17 | +import java.util.concurrent.Executors; | |
| 18 | + | |
| 19 | +/** | |
| 20 | + * 实时信号数据处理 | |
| 21 | + * Created by panzhao on 2017/11/15. | |
| 22 | + */ | |
| 23 | +@Component | |
| 24 | +public class DataHandleProcess { | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + GpsStateProcess gpsStateProcess; | |
| 28 | + @Autowired | |
| 29 | + StationInsideProcess stationInsideProcess; | |
| 30 | + @Autowired | |
| 31 | + AbnormalStateProcess abnormalStateProcess; | |
| 32 | + @Autowired | |
| 33 | + InStationProcess inStationProcess; | |
| 34 | + @Autowired | |
| 35 | + OutStationProcess outStationProcess; | |
| 36 | + @Autowired | |
| 37 | + ReverseRouteProcess reverseRouteProcess; | |
| 38 | + @Autowired | |
| 39 | + GpsRealData gpsRealData; | |
| 40 | + | |
| 41 | + | |
| 42 | + static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class); | |
| 43 | + | |
| 44 | + final static int POOL_SIZE = 9; | |
| 45 | + | |
| 46 | + static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1); | |
| 47 | + public static CountDownLatch count; | |
| 48 | + | |
| 49 | + static long lastTime; | |
| 50 | + | |
| 51 | + public static boolean isBlock() { | |
| 52 | + return System.currentTimeMillis() - lastTime > 1000 * 30; | |
| 53 | + } | |
| 54 | + | |
| 55 | + public void handle(List<GpsEntity> list) { | |
| 56 | + try { | |
| 57 | + if (list.size() == 0) | |
| 58 | + return; | |
| 59 | + lastTime = System.currentTimeMillis(); | |
| 60 | + //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑) | |
| 61 | + ArrayListMultimap multimap = ArrayListMultimap.create(); | |
| 62 | + for (GpsEntity gps : list) { | |
| 63 | + multimap.put(gps.getDeviceId(), gps); | |
| 64 | + } | |
| 65 | + List<String> deviceList = new ArrayList<>(multimap.keySet()); | |
| 66 | + | |
| 67 | + //数据均分给线程 | |
| 68 | + ArrayListMultimap dataListMap = ArrayListMultimap.create(); | |
| 69 | + int size = deviceList.size(), threadIndex = 0, threadSize = size / POOL_SIZE; | |
| 70 | + if(threadSize==0) | |
| 71 | + threadSize = size; | |
| 72 | + for (int i = 0; i < size; i++) { | |
| 73 | + if (i % threadSize == 0) | |
| 74 | + threadIndex++; | |
| 75 | + dataListMap.putAll(threadIndex, multimap.get(deviceList.get(i))); | |
| 76 | + } | |
| 77 | + Set<Integer> ks = dataListMap.keySet(); | |
| 78 | + logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size()); | |
| 79 | + count = new CountDownLatch(ks.size()); | |
| 80 | + | |
| 81 | + logger.info(JSON.toJSONString(ks)); | |
| 82 | + for (Integer index : ks) { | |
| 83 | + threadPool.execute(new SignalHandleThread(dataListMap.get(index), count)); | |
| 84 | + } | |
| 85 | + | |
| 86 | + | |
| 87 | + //等待子线程结束 | |
| 88 | + count.await(); | |
| 89 | + | |
| 90 | + //加入实时gps对照 | |
| 91 | + for (GpsEntity gps : list) | |
| 92 | + gpsRealData.put(gps); | |
| 93 | + | |
| 94 | + logger.info("time , " + (System.currentTimeMillis() - lastTime)); | |
| 95 | + } catch (Exception e) { | |
| 96 | + logger.error("", e); | |
| 97 | + } | |
| 98 | + } | |
| 99 | + | |
| 100 | + static GpsComp comp = new GpsComp(); | |
| 101 | + | |
| 102 | + public class SignalHandleThread implements Runnable { | |
| 103 | + | |
| 104 | + List<GpsEntity> list; | |
| 105 | + CountDownLatch count; | |
| 106 | + | |
| 107 | + SignalHandleThread(List<GpsEntity> gpsList, CountDownLatch count) { | |
| 108 | + this.list = gpsList; | |
| 109 | + this.count = count; | |
| 110 | + } | |
| 111 | + | |
| 112 | + @Override | |
| 113 | + public void run() { | |
| 114 | + try { | |
| 115 | + Collections.sort(list, comp); | |
| 116 | + GpsEntity gps; | |
| 117 | + for(int i = 0,len = list.size(); i< len ;i ++){ | |
| 118 | + gps = list.get(i); | |
| 119 | + | |
| 120 | + try { | |
| 121 | + if (StringUtils.isEmpty(gps.getNbbm())) | |
| 122 | + continue; | |
| 123 | + if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20) | |
| 124 | + continue; | |
| 125 | + | |
| 126 | + gpsStateProcess.process(gps);//状态处理 | |
| 127 | + stationInsideProcess.process(gps);//场站内外判定 | |
| 128 | + reverseRouteProcess.process(gps);//反向路由处理 | |
| 129 | + abnormalStateProcess.process(gps);//超速越界 | |
| 130 | + | |
| 131 | + inStationProcess.process(gps);//进站 | |
| 132 | + outStationProcess.process(gps);//出站 | |
| 133 | + | |
| 134 | + | |
| 135 | + GpsCacheData.putGps(gps);//历史gps缓存 | |
| 136 | + } catch (Throwable e) { | |
| 137 | + logger.error("", e); | |
| 138 | + } | |
| 139 | + } | |
| 140 | + } finally { | |
| 141 | + if (count != null) | |
| 142 | + count.countDown(); | |
| 143 | + } | |
| 144 | + } | |
| 145 | + } | |
| 146 | + | |
| 147 | + public static class GpsComp implements Comparator<GpsEntity> { | |
| 148 | + | |
| 149 | + @Override | |
| 150 | + public int compare(GpsEntity g1, GpsEntity g2) { | |
| 151 | + return g1.getTimestamp().compareTo(g2.getTimestamp()); | |
| 152 | + } | |
| 153 | + } | |
| 154 | 154 | } |
| 155 | 155 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
| 1 | -package com.bsth.data.gpsdata_v2.cache; | |
| 2 | - | |
| 3 | -import com.bsth.data.gpsdata_v2.entity.GpsEntity; | |
| 4 | -import com.bsth.data.gpsdata_v2.entity.StationRoute; | |
| 5 | -import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail; | |
| 6 | -import com.bsth.data.gpsdata_v2.utils.CircleQueue; | |
| 7 | -import com.google.common.collect.ArrayListMultimap; | |
| 8 | -import org.slf4j.Logger; | |
| 9 | -import org.slf4j.LoggerFactory; | |
| 10 | - | |
| 11 | -import java.util.*; | |
| 12 | -import java.util.concurrent.ConcurrentHashMap; | |
| 13 | -import java.util.concurrent.ConcurrentMap; | |
| 14 | - | |
| 15 | -/** | |
| 16 | - * gps 数据缓存 | |
| 17 | - * Created by panzhao on 2017/11/15. | |
| 18 | - */ | |
| 19 | -public class GpsCacheData { | |
| 20 | - | |
| 21 | - /** | |
| 22 | - * 每辆车缓存最后200条gps | |
| 23 | - */ | |
| 24 | - private static final int CACHE_SIZE = 200; | |
| 25 | - private static ConcurrentMap<String, CircleQueue<GpsEntity>> gpsCacheMap = new ConcurrentHashMap<>(); | |
| 26 | - | |
| 27 | - /** | |
| 28 | - * 车辆执行班次的详细 进出站数据 | |
| 29 | - */ | |
| 30 | - private static ArrayListMultimap<String, GpsExecTrail> trailListMultimap = ArrayListMultimap.create(); | |
| 31 | - | |
| 32 | - static Logger logger = LoggerFactory.getLogger(GpsCacheData.class); | |
| 33 | - | |
| 34 | - public static CircleQueue<GpsEntity> getGps(String device) { | |
| 35 | - return gpsCacheMap.get(device); | |
| 36 | - } | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 清除车辆的轨迹数据 | |
| 40 | - * @param nbbm | |
| 41 | - */ | |
| 42 | - public static void remove(String nbbm){ | |
| 43 | - //logger.info("清除车辆到离站轨迹, " + nbbm); | |
| 44 | - trailListMultimap.removeAll(nbbm); | |
| 45 | - } | |
| 46 | - | |
| 47 | - public static GpsExecTrail gpsExecTrail(String nbbm){ | |
| 48 | - List<GpsExecTrail> list = trailListMultimap.get(nbbm); | |
| 49 | - | |
| 50 | - GpsExecTrail trail; | |
| 51 | - if(null == list || list.size() == 0 | |
| 52 | - || list.get(list.size() - 1).isEnd()){ | |
| 53 | - trail = new GpsExecTrail(); | |
| 54 | - | |
| 55 | - trailListMultimap.put(nbbm, trail); | |
| 56 | - } | |
| 57 | - else{ | |
| 58 | - trail = list.get(list.size() - 1); | |
| 59 | - } | |
| 60 | - | |
| 61 | - return trail; | |
| 62 | - } | |
| 63 | - | |
| 64 | - public static void out(GpsEntity gps){ | |
| 65 | - GpsExecTrail trail = gpsExecTrail(gps.getNbbm()); | |
| 66 | - trail.getSrs().add(gps); | |
| 67 | - | |
| 68 | - } | |
| 69 | - | |
| 70 | - public static void in(GpsEntity gps, boolean end){ | |
| 71 | - GpsExecTrail trail = gpsExecTrail(gps.getNbbm()); | |
| 72 | - trail.getSrs().add(gps); | |
| 73 | - trail.setEnd(end); | |
| 74 | - } | |
| 75 | - | |
| 76 | - public static GpsEntity getPrev(GpsEntity gps){ | |
| 77 | - CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId()); | |
| 78 | - if(queue != null) | |
| 79 | - return queue.getTail(); | |
| 80 | - return null; | |
| 81 | - } | |
| 82 | - | |
| 83 | - public static void putGps(GpsEntity gps) { | |
| 84 | - CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId()); | |
| 85 | - if (queue == null) { | |
| 86 | - queue = new CircleQueue<>(CACHE_SIZE); | |
| 87 | - gpsCacheMap.put(gps.getDeviceId(), queue); | |
| 88 | - } | |
| 89 | - queue.add(gps); | |
| 90 | - } | |
| 91 | - | |
| 92 | - public static void clear(String deviceId) { | |
| 93 | - try { | |
| 94 | - CircleQueue<GpsEntity> queue = gpsCacheMap.get(deviceId); | |
| 95 | - if (queue != null) | |
| 96 | - queue.clear(); | |
| 97 | - } catch (Exception e) { | |
| 98 | - logger.error("", e); | |
| 99 | - } | |
| 100 | - } | |
| 101 | - | |
| 102 | - public static StationRoute prevStation(GpsEntity gps) { | |
| 103 | - List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm()); | |
| 104 | - if(null == trails || trails.size() == 0) | |
| 105 | - return null; | |
| 106 | - | |
| 107 | - GpsEntity prev; | |
| 108 | - for(int i = trails.size() - 1; i > 0; i--){ | |
| 109 | - prev = trails.get(i).getSrs().peekLast(); | |
| 110 | - | |
| 111 | - if(prev != null){ | |
| 112 | - return GeoCacheData.getRouteCode(prev); | |
| 113 | - } | |
| 114 | - } | |
| 115 | - return null; | |
| 116 | - } | |
| 117 | - | |
| 118 | - /** | |
| 119 | - * 最后一段轨迹 | |
| 120 | - * @param gps | |
| 121 | - * @return | |
| 122 | - */ | |
| 123 | - public static int lastInTrailsSize(GpsEntity gps) { | |
| 124 | - //int size = 0; | |
| 125 | - List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm()); | |
| 126 | - if(null == trails || trails.size() == 0) | |
| 127 | - return 0; | |
| 128 | - | |
| 129 | - GpsExecTrail gs = trails.get(trails.size() - 1); | |
| 130 | - if(gs.isEnd()) | |
| 131 | - return 0; | |
| 132 | - | |
| 133 | - Set<String> set = new HashSet<>(); | |
| 134 | - for(GpsEntity g : gs.getSrs()){ | |
| 135 | - if(g.getInstation() == 1) | |
| 136 | - set.add(g.getStation().getName()); | |
| 137 | - } | |
| 138 | - return set.size(); | |
| 139 | - } | |
| 140 | - | |
| 141 | - public static List<StationRoute> prevMultiStation(GpsEntity gps) { | |
| 142 | - List<StationRoute> rs = new ArrayList<>(); | |
| 143 | - List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm()); | |
| 144 | - if(null == trails || trails.size() == 0) | |
| 145 | - return null; | |
| 146 | - | |
| 147 | - for(int i = trails.size() - 1; i > 0; i--){ | |
| 148 | - rs.addAll(searchLinked(trails.get(i).getSrs(), gps.getUpDown())); | |
| 149 | - if(rs.size() > 3) | |
| 150 | - break; | |
| 151 | - } | |
| 152 | - return rs; | |
| 153 | - } | |
| 154 | - | |
| 155 | - private static List<StationRoute> searchLinked(LinkedList<GpsEntity> list, int upDown){ | |
| 156 | - List<StationRoute> rs = new ArrayList<>(); | |
| 157 | - | |
| 158 | - GpsEntity gps; | |
| 159 | - int prevCode=0; | |
| 160 | - for(int i = list.size() - 1; i > 0; i --){ | |
| 161 | - gps = list.get(i); | |
| 162 | - if(gps.getInstation()!=1) | |
| 163 | - continue; | |
| 164 | - | |
| 165 | - if(gps.getUpDown() != upDown) | |
| 166 | - break; | |
| 167 | - | |
| 168 | - if(gps.getStation().getRouteSort() != prevCode) | |
| 169 | - rs.add(gps.getStation()); | |
| 170 | - | |
| 171 | - prevCode = gps.getStation().getRouteSort(); | |
| 172 | - | |
| 173 | - if(rs.size() >= 3) | |
| 174 | - break; | |
| 175 | - } | |
| 176 | - return rs; | |
| 177 | - } | |
| 178 | -} | |
| 1 | +package com.bsth.data.gpsdata_v2.cache; | |
| 2 | + | |
| 3 | +import com.bsth.data.gpsdata_v2.entity.GpsEntity; | |
| 4 | +import com.bsth.data.gpsdata_v2.entity.StationRoute; | |
| 5 | +import com.bsth.data.gpsdata_v2.entity.trail.GpsExecTrail; | |
| 6 | +import com.bsth.data.gpsdata_v2.utils.CircleQueue; | |
| 7 | +import com.google.common.collect.ArrayListMultimap; | |
| 8 | +import org.slf4j.Logger; | |
| 9 | +import org.slf4j.LoggerFactory; | |
| 10 | + | |
| 11 | +import java.util.*; | |
| 12 | +import java.util.concurrent.ConcurrentHashMap; | |
| 13 | +import java.util.concurrent.ConcurrentMap; | |
| 14 | +import java.util.concurrent.CopyOnWriteArrayList; | |
| 15 | + | |
| 16 | +/** | |
| 17 | + * gps 数据缓存 | |
| 18 | + * Created by panzhao on 2017/11/15. | |
| 19 | + */ | |
| 20 | +public class GpsCacheData { | |
| 21 | + | |
| 22 | + /** | |
| 23 | + * 每辆车缓存最后200条gps | |
| 24 | + */ | |
| 25 | + private static final int CACHE_SIZE = 200; | |
| 26 | + private static ConcurrentMap<String, CircleQueue<GpsEntity>> gpsCacheMap = new ConcurrentHashMap<>(); | |
| 27 | + | |
| 28 | + /** | |
| 29 | + * 车辆执行班次的详细 进出站数据 | |
| 30 | + */ | |
| 31 | + //private static ArrayListMultimap<String, GpsExecTrail> trailListMultimap = ArrayListMultimap.create(); | |
| 32 | + private static Map<String, List<GpsExecTrail>> trailListMultimap = new ConcurrentHashMap<>(); | |
| 33 | + | |
| 34 | + static Logger logger = LoggerFactory.getLogger(GpsCacheData.class); | |
| 35 | + | |
| 36 | + public static CircleQueue<GpsEntity> getGps(String device) { | |
| 37 | + return gpsCacheMap.get(device); | |
| 38 | + } | |
| 39 | + | |
| 40 | + /** | |
| 41 | + * 清除车辆的轨迹数据 | |
| 42 | + * @param nbbm | |
| 43 | + */ | |
| 44 | + public static void remove(String nbbm){ | |
| 45 | + //logger.info("清除车辆到离站轨迹, " + nbbm); | |
| 46 | + trailListMultimap.remove(nbbm); | |
| 47 | + } | |
| 48 | + | |
| 49 | + public static GpsExecTrail gpsExecTrail(String nbbm){ | |
| 50 | + List<GpsExecTrail> list = trailListMultimap.get(nbbm); | |
| 51 | + | |
| 52 | + GpsExecTrail trail; | |
| 53 | + if (null == list || list.size() == 0 || list.get(list.size() - 1).isEnd()) { | |
| 54 | + if (null == list) { | |
| 55 | + list = new CopyOnWriteArrayList<>(); | |
| 56 | + trailListMultimap.put(nbbm, list); | |
| 57 | + } | |
| 58 | + trail = new GpsExecTrail(); | |
| 59 | + list.add(trail); | |
| 60 | + } else{ | |
| 61 | + trail = list.get(list.size() - 1); | |
| 62 | + } | |
| 63 | + | |
| 64 | + return trail; | |
| 65 | + } | |
| 66 | + | |
| 67 | + public static void out(GpsEntity gps){ | |
| 68 | + GpsExecTrail trail = gpsExecTrail(gps.getNbbm()); | |
| 69 | + trail.getSrs().add(gps); | |
| 70 | + | |
| 71 | + } | |
| 72 | + | |
| 73 | + public static void in(GpsEntity gps, boolean end){ | |
| 74 | + GpsExecTrail trail = gpsExecTrail(gps.getNbbm()); | |
| 75 | + trail.getSrs().add(gps); | |
| 76 | + trail.setEnd(end); | |
| 77 | + } | |
| 78 | + | |
| 79 | + public static GpsEntity getPrev(GpsEntity gps){ | |
| 80 | + CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId()); | |
| 81 | + if(queue != null) | |
| 82 | + return queue.getTail(); | |
| 83 | + return null; | |
| 84 | + } | |
| 85 | + | |
| 86 | + public static void putGps(GpsEntity gps) { | |
| 87 | + CircleQueue<GpsEntity> queue = gpsCacheMap.get(gps.getDeviceId()); | |
| 88 | + if (queue == null) { | |
| 89 | + queue = new CircleQueue<>(CACHE_SIZE); | |
| 90 | + gpsCacheMap.put(gps.getDeviceId(), queue); | |
| 91 | + } | |
| 92 | + queue.add(gps); | |
| 93 | + } | |
| 94 | + | |
| 95 | + public static void clear(String deviceId) { | |
| 96 | + try { | |
| 97 | + CircleQueue<GpsEntity> queue = gpsCacheMap.get(deviceId); | |
| 98 | + if (queue != null) | |
| 99 | + queue.clear(); | |
| 100 | + } catch (Exception e) { | |
| 101 | + logger.error("", e); | |
| 102 | + } | |
| 103 | + } | |
| 104 | + | |
| 105 | + public static StationRoute prevStation(GpsEntity gps) { | |
| 106 | + List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm()); | |
| 107 | + if(null == trails || trails.size() == 0) | |
| 108 | + return null; | |
| 109 | + | |
| 110 | + GpsEntity prev; | |
| 111 | + for(int i = trails.size() - 1; i > 0; i--){ | |
| 112 | + prev = trails.get(i).getSrs().peekLast(); | |
| 113 | + | |
| 114 | + if(prev != null){ | |
| 115 | + return GeoCacheData.getRouteCode(prev); | |
| 116 | + } | |
| 117 | + } | |
| 118 | + return null; | |
| 119 | + } | |
| 120 | + | |
| 121 | + /** | |
| 122 | + * 最后一段轨迹 | |
| 123 | + * @param gps | |
| 124 | + * @return | |
| 125 | + */ | |
| 126 | + public static int lastInTrailsSize(GpsEntity gps) { | |
| 127 | + //int size = 0; | |
| 128 | + List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm()); | |
| 129 | + if(null == trails || trails.size() == 0) | |
| 130 | + return 0; | |
| 131 | + | |
| 132 | + GpsExecTrail gs = trails.get(trails.size() - 1); | |
| 133 | + if(gs.isEnd()) | |
| 134 | + return 0; | |
| 135 | + | |
| 136 | + Set<String> set = new HashSet<>(); | |
| 137 | + for(GpsEntity g : gs.getSrs()){ | |
| 138 | + if(g.getInstation() == 1) | |
| 139 | + set.add(g.getStation().getName()); | |
| 140 | + } | |
| 141 | + return set.size(); | |
| 142 | + } | |
| 143 | + | |
| 144 | + public static List<StationRoute> prevMultiStation(GpsEntity gps) { | |
| 145 | + List<StationRoute> rs = new ArrayList<>(); | |
| 146 | + List<GpsExecTrail> trails = trailListMultimap.get(gps.getNbbm()); | |
| 147 | + if(null == trails || trails.size() == 0) | |
| 148 | + return null; | |
| 149 | + | |
| 150 | + for(int i = trails.size() - 1; i > 0; i--){ | |
| 151 | + rs.addAll(searchLinked(trails.get(i).getSrs(), gps.getUpDown())); | |
| 152 | + if(rs.size() > 3) | |
| 153 | + break; | |
| 154 | + } | |
| 155 | + return rs; | |
| 156 | + } | |
| 157 | + | |
| 158 | + private static List<StationRoute> searchLinked(LinkedList<GpsEntity> list, int upDown){ | |
| 159 | + List<StationRoute> rs = new ArrayList<>(); | |
| 160 | + | |
| 161 | + GpsEntity gps; | |
| 162 | + int prevCode=0; | |
| 163 | + for(int i = list.size() - 1; i > 0; i --){ | |
| 164 | + gps = list.get(i); | |
| 165 | + if(gps.getInstation()!=1) | |
| 166 | + continue; | |
| 167 | + | |
| 168 | + if(gps.getUpDown() != upDown) | |
| 169 | + break; | |
| 170 | + | |
| 171 | + if(gps.getStation().getRouteSort() != prevCode) | |
| 172 | + rs.add(gps.getStation()); | |
| 173 | + | |
| 174 | + prevCode = gps.getStation().getRouteSort(); | |
| 175 | + | |
| 176 | + if(rs.size() >= 3) | |
| 177 | + break; | |
| 178 | + } | |
| 179 | + return rs; | |
| 180 | + } | |
| 181 | +} | ... | ... |