Commit d5f2bc442a72cc0054354edb8753b8d3f1489c66
1 parent
d60383a8
站点道闸更新
Showing
3 changed files
with
129 additions
and
19 deletions
src/main/java/com/bsth/controller/directive/UpstreamEntrance.java
| @@ -6,9 +6,11 @@ import org.apache.commons.lang3.StringUtils; | @@ -6,9 +6,11 @@ import org.apache.commons.lang3.StringUtils; | ||
| 6 | import org.slf4j.Logger; | 6 | import org.slf4j.Logger; |
| 7 | import org.slf4j.LoggerFactory; | 7 | import org.slf4j.LoggerFactory; |
| 8 | import org.springframework.beans.factory.annotation.Autowired; | 8 | import org.springframework.beans.factory.annotation.Autowired; |
| 9 | +import org.springframework.web.bind.annotation.RequestBody; | ||
| 9 | import org.springframework.web.bind.annotation.RequestMapping; | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | import org.springframework.web.bind.annotation.RequestMethod; | 11 | import org.springframework.web.bind.annotation.RequestMethod; |
| 11 | import org.springframework.web.bind.annotation.RequestParam; | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 12 | import org.springframework.web.bind.annotation.RestController; | 14 | import org.springframework.web.bind.annotation.RestController; |
| 13 | 15 | ||
| 14 | import com.alibaba.fastjson.JSON; | 16 | import com.alibaba.fastjson.JSON; |
| @@ -100,7 +102,8 @@ public class UpstreamEntrance { | @@ -100,7 +102,8 @@ public class UpstreamEntrance { | ||
| 100 | } | 102 | } |
| 101 | 103 | ||
| 102 | @RequestMapping(value = "/stationSigno", method = RequestMethod.POST) | 104 | @RequestMapping(value = "/stationSigno", method = RequestMethod.POST) |
| 103 | - public Map<String, Object> stationSigno(@RequestParam Map<String, Object> map) { | 105 | + @ResponseBody |
| 106 | + public Map<String, Object> stationSigno(@RequestBody Map<String, Object> map) { | ||
| 104 | return directiveService.stationSigno(map); | 107 | return directiveService.stationSigno(map); |
| 105 | } | 108 | } |
| 106 | @RequestMapping(value = "/tagByLines", method = RequestMethod.GET) | 109 | @RequestMapping(value = "/tagByLines", method = RequestMethod.GET) |
src/main/java/com/bsth/service/directive/DirectiveServiceImpl.java
| @@ -599,6 +599,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -599,6 +599,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 599 | Long fOutTime = map.get("fOutTime")==null?0:(Long.parseLong(map.get("fOutTime").toString())*1000); | 599 | Long fOutTime = map.get("fOutTime")==null?0:(Long.parseLong(map.get("fOutTime").toString())*1000); |
| 600 | int fIsOut = map.get("fIsOut")==null?0:Integer.parseInt(map.get("fIsOut").toString()); | 600 | int fIsOut = map.get("fIsOut")==null?0:Integer.parseInt(map.get("fIsOut").toString()); |
| 601 | Long fInTime = map.get("fInTime")==null?0:(Long.parseLong(map.get("fInTime").toString())*1000); | 601 | Long fInTime = map.get("fInTime")==null?0:(Long.parseLong(map.get("fInTime").toString())*1000); |
| 602 | + | ||
| 602 | // String fInPlate = map.get("fInPlate")==null?"":map.get("fInPlate").toString(); | 603 | // String fInPlate = map.get("fInPlate")==null?"":map.get("fInPlate").toString(); |
| 603 | // String fInStatus = map.get("fInStatus")==null?"":map.get("fInStatus").toString(); | 604 | // String fInStatus = map.get("fInStatus")==null?"":map.get("fInStatus").toString(); |
| 604 | // String fOutStatus = map.get("fOutStatus")==null?"":map.get("fOutStatus").toString(); | 605 | // String fOutStatus = map.get("fOutStatus")==null?"":map.get("fOutStatus").toString(); |
| @@ -624,32 +625,79 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -624,32 +625,79 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 624 | } | 625 | } |
| 625 | } | 626 | } |
| 626 | 627 | ||
| 627 | - ScheduleRealInfo sr = dayOfSchedule.executeCurr(basicData.plateCompanyNbbmMap.get(fPlateCode)); | ||
| 628 | - if(sr==null){ | ||
| 629 | - List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(basicData.plateCompanyNbbmMap.get(fPlateCode)); | ||
| 630 | - int size = list.size(); | ||
| 631 | - | ||
| 632 | - // 班次完成10分钟内上传道闸消息,可以标记 | ||
| 633 | - Long time = 10*60*1000L; | 628 | + String carPlate = basicData.plateCompanyNbbmMap.get(fPlateCode); |
| 629 | + if(StringUtils.isEmpty(carPlate)){ | ||
| 630 | + rs.put("code",-1); | ||
| 631 | + rs.put("message","失败"); | ||
| 632 | + rs.put("info","车牌号不在调度系统中"); | ||
| 633 | + return rs; | ||
| 634 | + } | ||
| 635 | + // 是否为补传数据 | ||
| 636 | + boolean isbc = false; | ||
| 637 | + Long date = new Date().getTime(); | ||
| 638 | + Long timeT = 0l; | ||
| 639 | + if (fIsOut == 1 && fInTime != 0) { | ||
| 640 | + timeT = fInTime; | ||
| 641 | + } else if (fIsOut == 2 && fOutTime != 0) { | ||
| 642 | + timeT = fOutTime; | ||
| 643 | + } | ||
| 644 | + ScheduleRealInfo sr = null; | ||
| 645 | + List<ScheduleRealInfo> list = dayOfSchedule.findByNbbm(carPlate); | ||
| 646 | + int size = list.size(); | ||
| 647 | + | ||
| 648 | + // bcwcTime 补传误差允许时间,zcwcTime 正常误差允许时间 | ||
| 649 | + Long bcwcTime = 5*60*1000l; | ||
| 650 | + Long zcwcTime = 3*60*1000l; | ||
| 651 | + List<Map<String,Object>> timeL = jdbcTemplate.queryForList("select bcwc_time,zcwc_time from bsth_tag_time"); | ||
| 652 | + if(timeL.size() > 0){ | ||
| 653 | + bcwcTime = Long.parseLong(timeL.get(0).get("bcwc_time").toString()); | ||
| 654 | + zcwcTime = Long.parseLong(timeL.get(0).get("zcwc_time").toString()); | ||
| 655 | + } | ||
| 656 | + // 大于当前时间5分钟为补传数据 | ||
| 657 | + if(Math.abs(date-timeT) > bcwcTime){ | ||
| 634 | for (int i = 0; i < size; i++) { | 658 | for (int i = 0; i < size; i++) { |
| 635 | ScheduleRealInfo isr = list.get(i); | 659 | ScheduleRealInfo isr = list.get(i); |
| 636 | if (list.get(i).isDestroy()) | 660 | if (list.get(i).isDestroy()) |
| 637 | continue; | 661 | continue; |
| 638 | - if(fIsOut == 2 && Math.abs(isr.getFcsjT()-fOutTime)<time){ | ||
| 639 | - time = Math.abs(isr.getFcsjT()-fOutTime); | 662 | + if(fIsOut == 2 && (Math.abs(isr.getDfsjT()-fOutTime)<bcwcTime || (isr.getFcsjActualTime() != null && Math.abs(isr.getFcsjActualTime()-fOutTime)<bcwcTime))){ |
| 663 | + bcwcTime = Math.abs(isr.getDfsjT()-fOutTime); | ||
| 640 | sr = isr; | 664 | sr = isr; |
| 641 | } | 665 | } |
| 642 | - if(fIsOut == 1 && Math.abs(isr.getZdsjT()-fInTime)<time){ | ||
| 643 | - time = Math.abs(isr.getZdsjT()-fInTime); | 666 | + if(fIsOut == 1 && (Math.abs(isr.getZdsjT()-fInTime)<bcwcTime || (isr.getZdsjActualTime() != null && Math.abs(isr.getZdsjActualTime()-fOutTime)<bcwcTime))){ |
| 667 | + bcwcTime = Math.abs(isr.getZdsjT()-fInTime); | ||
| 644 | sr = isr; | 668 | sr = isr; |
| 645 | } | 669 | } |
| 646 | } | 670 | } |
| 647 | if(sr==null){ | 671 | if(sr==null){ |
| 648 | - rs.put("code",-1); | ||
| 649 | - rs.put("message","失败"); | ||
| 650 | - rs.put("info","未找到车辆对应班次"); | 672 | + rs.put("code",0); |
| 673 | + rs.put("message","成功"); | ||
| 674 | + rs.put("info","补传成功,但未找到车辆对应班次"); | ||
| 651 | return rs; | 675 | return rs; |
| 652 | } | 676 | } |
| 677 | + } else { | ||
| 678 | + sr = dayOfSchedule.executeCurr(carPlate); | ||
| 679 | + if(sr==null){ | ||
| 680 | + // 班次完成3分钟内上传道闸消息,可以标记 | ||
| 681 | + for (int i = 0; i < size; i++) { | ||
| 682 | + ScheduleRealInfo isr = list.get(i); | ||
| 683 | + if (list.get(i).isDestroy()) | ||
| 684 | + continue; | ||
| 685 | + if(fIsOut == 2 && (Math.abs(isr.getDfsjT()-fOutTime)<bcwcTime || (isr.getFcsjActualTime() != null && Math.abs(isr.getFcsjActualTime()-fOutTime)<bcwcTime))){ | ||
| 686 | + bcwcTime = Math.abs(isr.getDfsjT()-fOutTime); | ||
| 687 | + sr = isr; | ||
| 688 | + } | ||
| 689 | + if(fIsOut == 1 && (Math.abs(isr.getZdsjT()-fInTime)<bcwcTime || (isr.getZdsjActualTime() != null && Math.abs(isr.getZdsjActualTime()-fOutTime)<bcwcTime))){ | ||
| 690 | + bcwcTime = Math.abs(isr.getZdsjT()-fInTime); | ||
| 691 | + sr = isr; | ||
| 692 | + } | ||
| 693 | + } | ||
| 694 | + if(sr==null){ | ||
| 695 | + rs.put("code",-1); | ||
| 696 | + rs.put("message","失败"); | ||
| 697 | + rs.put("info","未找到车辆对应班次"); | ||
| 698 | + return rs; | ||
| 699 | + } | ||
| 700 | + } | ||
| 653 | } | 701 | } |
| 654 | ScheduleRealInfo prevSr = dayOfSchedule.prev(sr); | 702 | ScheduleRealInfo prevSr = dayOfSchedule.prev(sr); |
| 655 | ScheduleRealInfo nextSr = dayOfSchedule.next(sr); | 703 | ScheduleRealInfo nextSr = dayOfSchedule.next(sr); |
| @@ -666,7 +714,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -666,7 +714,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 666 | * 到达时间接近那个班次的进场/出场判定为这个班次 | 714 | * 到达时间接近那个班次的进场/出场判定为这个班次 |
| 667 | */ | 715 | */ |
| 668 | if (fIsOut == 1 && fInTime != 0) { | 716 | if (fIsOut == 1 && fInTime != 0) { |
| 669 | - if(prevSr == null || (Math.abs((sr.getDfsjT()- fInTime)) < Math.abs((prevSr.getDfsjT()- fInTime)))){ | 717 | + if(prevSr == null || (Math.abs((sr.getZdsjT()- fInTime)) < Math.abs((prevSr.getZdsjT()- fInTime)))){ |
| 670 | isMatch = true; | 718 | isMatch = true; |
| 671 | matchSr = sr; | 719 | matchSr = sr; |
| 672 | } else {//if(Math.abs((prevSr.getDfsjT())- fInTime) < 120) | 720 | } else {//if(Math.abs((prevSr.getDfsjT())- fInTime) < 120) |
| @@ -802,6 +850,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -802,6 +850,8 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 802 | sendUtils.stationSigno(tagNext); | 850 | sendUtils.stationSigno(tagNext); |
| 803 | } | 851 | } |
| 804 | 852 | ||
| 853 | +// System.out.println("stationSigno----"+map); | ||
| 854 | + System.out.println("stationSigno-info---:fPlateCode"+fPlateCode+",fBusID"+fBusID+",fOutTime"+fOutTime+",fIsOut"+fIsOut+",fInTime"+fInTime); | ||
| 805 | rs.put("code",0); | 855 | rs.put("code",0); |
| 806 | rs.put("message","成功"); | 856 | rs.put("message","成功"); |
| 807 | return rs; | 857 | return rs; |
| @@ -824,9 +874,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -824,9 +874,14 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 824 | public List<ScheduleRealInfoTag> tagByLines(String lines) { | 874 | public List<ScheduleRealInfoTag> tagByLines(String lines) { |
| 825 | List<ScheduleRealInfoTag> list = new ArrayList<>(); | 875 | List<ScheduleRealInfoTag> list = new ArrayList<>(); |
| 826 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); | 876 | List<String> lineList = Lists.newArrayList(Splitter.on(',').trimResults().omitEmptyStrings().split(lines)); |
| 877 | + String line = ""; | ||
| 878 | + for (String l:lineList) { | ||
| 879 | + line += "'"+l+"',"; | ||
| 880 | + } | ||
| 881 | + line = line.substring(0,line.length()-1); | ||
| 827 | String day = DayOfSchedule.currSchDateMap.get(lineList.get(0)); | 882 | String day = DayOfSchedule.currSchDateMap.get(lineList.get(0)); |
| 828 | try{ | 883 | try{ |
| 829 | - list = jdbcTemplate.query("select * from bsth_c_s_sp_info_real_tag where xl_bm in (?) and schedule_date_str = ? ", new RowMapper<ScheduleRealInfoTag>() { | 884 | + list = jdbcTemplate.query("select * from bsth_c_s_sp_info_real_tag where xl_bm in ("+line+") and schedule_date_str = '"+day+"'", new RowMapper<ScheduleRealInfoTag>() { |
| 830 | @Override | 885 | @Override |
| 831 | public ScheduleRealInfoTag mapRow(ResultSet resultSet, int i) throws SQLException { | 886 | public ScheduleRealInfoTag mapRow(ResultSet resultSet, int i) throws SQLException { |
| 832 | ScheduleRealInfoTag srt = new ScheduleRealInfoTag(); | 887 | ScheduleRealInfoTag srt = new ScheduleRealInfoTag(); |
| @@ -848,7 +903,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | @@ -848,7 +903,7 @@ public class DirectiveServiceImpl extends BaseServiceImpl<D60, Integer> implemen | ||
| 848 | srt.setScheduleDateStr(resultSet.getString("schedule_date_str")); | 903 | srt.setScheduleDateStr(resultSet.getString("schedule_date_str")); |
| 849 | return srt; | 904 | return srt; |
| 850 | } | 905 | } |
| 851 | - }, lines, day); | 906 | + }); |
| 852 | }catch (Exception e){ | 907 | }catch (Exception e){ |
| 853 | logger.error(e.toString(),e); | 908 | logger.error(e.toString(),e); |
| 854 | return null; | 909 | return null; |
src/main/resources/static/real_control_v2/js/line_schedule/sch_table.js
| @@ -219,10 +219,32 @@ var gb_schedule_table = (function () { | @@ -219,10 +219,32 @@ var gb_schedule_table = (function () { | ||
| 219 | var insertSchedule = function (sch, upArr) { | 219 | var insertSchedule = function (sch, upArr) { |
| 220 | var xls = {}; | 220 | var xls = {}; |
| 221 | xls[sch.xlBm] = 1; | 221 | xls[sch.xlBm] = 1; |
| 222 | + | ||
| 223 | + // 道闸标记 | ||
| 224 | + var tag = line2Schedule[sch.xlBm][sch.id]; | ||
| 225 | + if(tag.sd_tag == 1){ | ||
| 226 | + sch.sd_tag = sch.sd_tag; | ||
| 227 | + sch.sd_time = sch.sd_time; | ||
| 228 | + } | ||
| 229 | + if(tag.sf_tag == 1){ | ||
| 230 | + sch.sf_tag = sch.sf_tag; | ||
| 231 | + sch.sf_time = sch.sf_time; | ||
| 232 | + } | ||
| 222 | line2Schedule[sch.xlBm][sch.id] = sch; | 233 | line2Schedule[sch.xlBm][sch.id] = sch; |
| 223 | //update | 234 | //update |
| 224 | if (isArray(upArr)) { | 235 | if (isArray(upArr)) { |
| 225 | $.each(upArr, function () { | 236 | $.each(upArr, function () { |
| 237 | + | ||
| 238 | + // 道闸标记 | ||
| 239 | + var sch = line2Schedule[this.xlBm][this.id]; | ||
| 240 | + if(sch.sd_tag == 1){ | ||
| 241 | + this.sd_tag = sch.sd_tag; | ||
| 242 | + this.sd_time = sch.sd_time; | ||
| 243 | + } | ||
| 244 | + if(sch.sf_tag == 1){ | ||
| 245 | + this.sf_tag = sch.sf_tag; | ||
| 246 | + this.sf_time = sch.sf_time; | ||
| 247 | + } | ||
| 226 | line2Schedule[this.xlBm][this.id] = this; | 248 | line2Schedule[this.xlBm][this.id] = this; |
| 227 | xls[this.xlBm] = 1; | 249 | xls[this.xlBm] = 1; |
| 228 | }); | 250 | }); |
| @@ -342,7 +364,6 @@ var gb_schedule_table = (function () { | @@ -342,7 +364,6 @@ var gb_schedule_table = (function () { | ||
| 342 | * @param schArr | 364 | * @param schArr |
| 343 | */ | 365 | */ |
| 344 | var updateSchedule = function (schArr) { | 366 | var updateSchedule = function (schArr) { |
| 345 | - | ||
| 346 | if (!isArray(schArr)) | 367 | if (!isArray(schArr)) |
| 347 | schArr = [schArr]; | 368 | schArr = [schArr]; |
| 348 | 369 | ||
| @@ -353,6 +374,16 @@ var gb_schedule_table = (function () { | @@ -353,6 +374,16 @@ var gb_schedule_table = (function () { | ||
| 353 | clearActualTime(this); | 374 | clearActualTime(this); |
| 354 | //子任务公里是否与计划平 | 375 | //子任务公里是否与计划平 |
| 355 | this.c_t_mileage_status = calcCTaskMileageStatus(this); | 376 | this.c_t_mileage_status = calcCTaskMileageStatus(this); |
| 377 | + // 道闸标记 | ||
| 378 | + var sch = line2Schedule[this.xlBm][this.id]; | ||
| 379 | + if(sch.sd_tag == 1){ | ||
| 380 | + this.sd_tag = sch.sd_tag; | ||
| 381 | + this.sd_time = sch.sd_time; | ||
| 382 | + } | ||
| 383 | + if(sch.sf_tag == 1){ | ||
| 384 | + this.sf_tag = sch.sf_tag; | ||
| 385 | + this.sf_time = sch.sf_time; | ||
| 386 | + } | ||
| 356 | line2Schedule[this.xlBm][this.id] = this; | 387 | line2Schedule[this.xlBm][this.id] = this; |
| 357 | updateDom(this); | 388 | updateDom(this); |
| 358 | }catch(e){} | 389 | }catch(e){} |
| @@ -397,6 +428,17 @@ var gb_schedule_table = (function () { | @@ -397,6 +428,17 @@ var gb_schedule_table = (function () { | ||
| 397 | $.each(schArr, function () { | 428 | $.each(schArr, function () { |
| 398 | if(this.status==-1) | 429 | if(this.status==-1) |
| 399 | clearActualTime(this); | 430 | clearActualTime(this); |
| 431 | + | ||
| 432 | + // 道闸标记 | ||
| 433 | + var sch = line2Schedule[this.xlBm][this.id]; | ||
| 434 | + if(sch.sd_tag == 1){ | ||
| 435 | + this.sd_tag = sch.sd_tag; | ||
| 436 | + this.sd_time = sch.sd_time; | ||
| 437 | + } | ||
| 438 | + if(sch.sf_tag == 1){ | ||
| 439 | + this.sf_tag = sch.sf_tag; | ||
| 440 | + this.sf_time = sch.sf_time; | ||
| 441 | + } | ||
| 400 | line2Schedule[this.xlBm][this.id] = this; | 442 | line2Schedule[this.xlBm][this.id] = this; |
| 401 | }); | 443 | }); |
| 402 | }; | 444 | }; |
| @@ -834,6 +876,16 @@ var gb_schedule_table = (function () { | @@ -834,6 +876,16 @@ var gb_schedule_table = (function () { | ||
| 834 | gb_common.$post('/realSchedule/addRemarks', {id: sch.id, remarks: remarks}, function (rs) { | 876 | gb_common.$post('/realSchedule/addRemarks', {id: sch.id, remarks: remarks}, function (rs) { |
| 835 | if(rs.t){ | 877 | if(rs.t){ |
| 836 | sch = rs.t; | 878 | sch = rs.t; |
| 879 | + // 道闸标记 | ||
| 880 | + var tag = line2Schedule[sch.xlBm][sch.id]; | ||
| 881 | + if(tag.sd_tag == 1){ | ||
| 882 | + sch.sd_tag = tag.sd_tag; | ||
| 883 | + sch.sd_time = tag.sd_time; | ||
| 884 | + } | ||
| 885 | + if(tag.sf_tag == 1){ | ||
| 886 | + sch.sf_tag = tag.sf_tag; | ||
| 887 | + sch.sf_time = tag.sf_time; | ||
| 888 | + } | ||
| 837 | line2Schedule[sch.xlBm][sch.id] = sch; | 889 | line2Schedule[sch.xlBm][sch.id] = sch; |
| 838 | updateDom(sch); | 890 | updateDom(sch); |
| 839 | i++; | 891 | i++; |