Commit bba1d3e42c194c31d4bdda2119cb14c70201569a
1 parent
f47326ac
调度系统的大客流报警智能工具中需对可用车辆判定规则,优先从当日场站内正休息、停运和下班人员和车辆里选取
Showing
5 changed files
with
104 additions
and
8 deletions
src/main/java/com/bsth/data/zndd/AutomaticSch.java
| @@ -31,6 +31,8 @@ import java.text.SimpleDateFormat; | @@ -31,6 +31,8 @@ import java.text.SimpleDateFormat; | ||
| 31 | import java.util.*; | 31 | import java.util.*; |
| 32 | import java.util.concurrent.ConcurrentHashMap; | 32 | import java.util.concurrent.ConcurrentHashMap; |
| 33 | import java.util.concurrent.ConcurrentMap; | 33 | import java.util.concurrent.ConcurrentMap; |
| 34 | +import java.util.regex.Matcher; | ||
| 35 | +import java.util.regex.Pattern; | ||
| 34 | 36 | ||
| 35 | /** | 37 | /** |
| 36 | * 自动检测调度异常 | 38 | * 自动检测调度异常 |
| @@ -465,4 +467,19 @@ public class AutomaticSch { | @@ -465,4 +467,19 @@ public class AutomaticSch { | ||
| 465 | } | 467 | } |
| 466 | return null; | 468 | return null; |
| 467 | } | 469 | } |
| 470 | + | ||
| 471 | + public int getPenum(String type, String types){ | ||
| 472 | + int count =10; | ||
| 473 | + String penum=penum(type,types); | ||
| 474 | + if(penum!=null){ | ||
| 475 | + String regEx="[^0-9]"; | ||
| 476 | + Pattern p = Pattern.compile(regEx); | ||
| 477 | + Matcher m = p.matcher(penum); | ||
| 478 | + String result=m.replaceAll("").trim(); | ||
| 479 | + if(!result.equals("")){ | ||
| 480 | + count=Integer.parseInt(result); | ||
| 481 | + } | ||
| 482 | + } | ||
| 483 | + return count; | ||
| 484 | + } | ||
| 468 | } | 485 | } |
src/main/java/com/bsth/data/zndd/OutEntrance.java
| @@ -57,6 +57,9 @@ public class OutEntrance { | @@ -57,6 +57,9 @@ public class OutEntrance { | ||
| 57 | @Autowired | 57 | @Autowired |
| 58 | carMonitor carMonitor; | 58 | carMonitor carMonitor; |
| 59 | 59 | ||
| 60 | + @Autowired | ||
| 61 | + AutomaticSch automaticSch; | ||
| 62 | + | ||
| 60 | //调度屏小程序接口。 | 63 | //调度屏小程序接口。 |
| 61 | @RequestMapping(value = "/OutCar", method = RequestMethod.POST) | 64 | @RequestMapping(value = "/OutCar", method = RequestMethod.POST) |
| 62 | public Map OutCarOutCar(@RequestParam Map m,@RequestBody StationSignsLogger ssLogger) { | 65 | public Map OutCarOutCar(@RequestParam Map m,@RequestBody StationSignsLogger ssLogger) { |
| @@ -74,7 +77,8 @@ public class OutEntrance { | @@ -74,7 +77,8 @@ public class OutEntrance { | ||
| 74 | m.put("dir",ssLogger.getDir()); | 77 | m.put("dir",ssLogger.getDir()); |
| 75 | m.put("calleeId",ssLogger.getCalleeId()); | 78 | m.put("calleeId",ssLogger.getCalleeId()); |
| 76 | //线调页面推送 | 79 | //线调页面推送 |
| 77 | - if(ssLogger.getNum()>15){ | 80 | + int count=automaticSch.getPenum("DKL","0"); |
| 81 | + if(ssLogger.getNum()>count){ | ||
| 78 | sendUtils.stationcf(m); | 82 | sendUtils.stationcf(m); |
| 79 | } | 83 | } |
| 80 | 84 | ||
| @@ -134,7 +138,8 @@ public class OutEntrance { | @@ -134,7 +138,8 @@ public class OutEntrance { | ||
| 134 | return rtn; | 138 | return rtn; |
| 135 | } | 139 | } |
| 136 | String num=jsonObject.getString("num"); | 140 | String num=jsonObject.getString("num"); |
| 137 | - if(Integer.parseInt(num)<15){ | 141 | + int count=automaticSch.getPenum("DKL","0"); |
| 142 | + if(Integer.parseInt(num)<count){ | ||
| 138 | rtn.put("status",ResponseCode.SUCCESS); | 143 | rtn.put("status",ResponseCode.SUCCESS); |
| 139 | return rtn; | 144 | return rtn; |
| 140 | } | 145 | } |
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
| @@ -242,6 +242,8 @@ public class ScheduleRealInfo { | @@ -242,6 +242,8 @@ public class ScheduleRealInfo { | ||
| 242 | * 起点站rfid状态 | 242 | * 起点站rfid状态 |
| 243 | */ | 243 | */ |
| 244 | private int firstRfidState; | 244 | private int firstRfidState; |
| 245 | + @Transient | ||
| 246 | + private String kxcl; | ||
| 245 | 247 | ||
| 246 | public Integer getLpChange() { | 248 | public Integer getLpChange() { |
| 247 | return lpChange; | 249 | return lpChange; |
| @@ -1016,4 +1018,12 @@ public class ScheduleRealInfo { | @@ -1016,4 +1018,12 @@ public class ScheduleRealInfo { | ||
| 1016 | public void setFirstRfidState(int firstRfidState) { | 1018 | public void setFirstRfidState(int firstRfidState) { |
| 1017 | this.firstRfidState = firstRfidState; | 1019 | this.firstRfidState = firstRfidState; |
| 1018 | } | 1020 | } |
| 1021 | + | ||
| 1022 | + public String getKxcl() { | ||
| 1023 | + return kxcl; | ||
| 1024 | + } | ||
| 1025 | + | ||
| 1026 | + public void setKxcl(String kxcl) { | ||
| 1027 | + this.kxcl = kxcl; | ||
| 1028 | + } | ||
| 1019 | } | 1029 | } |
src/main/java/com/bsth/service/zndd/impl/LoggerZnddServiceImpl.java
| @@ -19,10 +19,9 @@ import org.springframework.stereotype.Service; | @@ -19,10 +19,9 @@ import org.springframework.stereotype.Service; | ||
| 19 | import org.springframework.transaction.annotation.Transactional; | 19 | import org.springframework.transaction.annotation.Transactional; |
| 20 | 20 | ||
| 21 | import java.text.SimpleDateFormat; | 21 | import java.text.SimpleDateFormat; |
| 22 | -import java.util.ArrayList; | ||
| 23 | -import java.util.Collections; | ||
| 24 | -import java.util.List; | ||
| 25 | -import java.util.Map; | 22 | +import java.time.LocalTime; |
| 23 | +import java.time.format.DateTimeFormatter; | ||
| 24 | +import java.util.*; | ||
| 26 | 25 | ||
| 27 | @Service | 26 | @Service |
| 28 | public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> implements LoggerZnddService { | 27 | public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> implements LoggerZnddService { |
| @@ -137,7 +136,46 @@ public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> | @@ -137,7 +136,46 @@ public class LoggerZnddServiceImpl extends BaseServiceImpl<LoggerZndd, Integer> | ||
| 137 | 136 | ||
| 138 | 137 | ||
| 139 | public ScheduleRealInfo thissch(Integer ids){ | 138 | public ScheduleRealInfo thissch(Integer ids){ |
| 140 | - return dayOfSchedule.next(dayOfSchedule.get(ids)); | 139 | + ScheduleRealInfo sch=dayOfSchedule.get(ids); |
| 140 | + Set<String> set = dayOfSchedule.findCarByLineCode(sch.getXlBm()); | ||
| 141 | + List<String> nbbms=new ArrayList<>(); | ||
| 142 | + List<String> jghs=new ArrayList<>(); | ||
| 143 | + List<String> jNames=new ArrayList<>(); | ||
| 144 | + LocalTime localTime=LocalTime.now().plusHours(1); | ||
| 145 | + DateTimeFormatter dtf=DateTimeFormatter.ofPattern("HH:mm"); | ||
| 146 | + for (String nbbm : set) { | ||
| 147 | + ScheduleRealInfo s=dayOfSchedule.executeCurr(nbbm);//当前执行班次 | ||
| 148 | + if(s==null){//当日班次执行完毕 | ||
| 149 | + List<ScheduleRealInfo> list=dayOfSchedule.findByNbbm(nbbm); | ||
| 150 | + if(list.size()>0){ | ||
| 151 | + ScheduleRealInfo s2=list.get(list.size()-1);//最后一个班次 | ||
| 152 | + nbbms.add(s2.getClZbh()); | ||
| 153 | + jghs.add(s2.getjGh()); | ||
| 154 | + jNames.add(s2.getjName()); | ||
| 155 | + } | ||
| 156 | + }else {//1小时内是否有待执行班次 | ||
| 157 | + LocalTime fcsj=LocalTime.parse(s.getFcsj(),dtf); | ||
| 158 | + if(fcsj.isAfter(localTime)){ | ||
| 159 | + nbbms.add(s.getClZbh()); | ||
| 160 | + jghs.add(s.getjGh()); | ||
| 161 | + jNames.add(s.getjName()); | ||
| 162 | + } | ||
| 163 | + } | ||
| 164 | + } | ||
| 165 | + StringBuffer sb=new StringBuffer(); | ||
| 166 | + String kscl=""; | ||
| 167 | + if(nbbms.size()>0){ | ||
| 168 | + sch.setClZbh(nbbms.get(0)); | ||
| 169 | + sch.setjGh(jghs.get(0)); | ||
| 170 | + sch.setjName(jNames.get(0)); | ||
| 171 | + for (int i = 0; i < nbbms.size(); i++) { | ||
| 172 | + sb.append(nbbms.get(i)+"/"); | ||
| 173 | + sb.append(jNames.get(i)+","); | ||
| 174 | + } | ||
| 175 | + kscl=sb.toString().substring(0,sb.length()-1); | ||
| 176 | + } | ||
| 177 | + sch.setKxcl(kscl); | ||
| 178 | + return sch; | ||
| 141 | } | 179 | } |
| 142 | 180 | ||
| 143 | 181 |
src/main/resources/static/real_control_v2/zndd/type/dkl.html
| @@ -126,6 +126,23 @@ | @@ -126,6 +126,23 @@ | ||
| 126 | //normal | 126 | //normal |
| 127 | $('.normalCont', modal).html(st_doms.normal_dom) | 127 | $('.normalCont', modal).html(st_doms.normal_dom) |
| 128 | .trigger('init', {sch: res, submitFun: submit_temp_schedule_form}); | 128 | .trigger('init', {sch: res, submitFun: submit_temp_schedule_form}); |
| 129 | + var kxcl=res.kxcl; | ||
| 130 | + var arr=kxcl.split(','); | ||
| 131 | + var s=''; | ||
| 132 | + var j=1; | ||
| 133 | + for(i=0;i<arr.length;i++){ | ||
| 134 | + if(j==1){ | ||
| 135 | + s+='<label className="uk-form-labels"><h3>'; | ||
| 136 | + } | ||
| 137 | + s+=arr[i]+","; | ||
| 138 | + j++; | ||
| 139 | + if(j==4||i==arr.length-1){ | ||
| 140 | + s=s.substring(0,s.length-1); | ||
| 141 | + s+='</h3></label>'; | ||
| 142 | + j=1; | ||
| 143 | + } | ||
| 144 | + } | ||
| 145 | + document.getElementById("nbbms").innerHTML=s; | ||
| 129 | }); | 146 | }); |
| 130 | 147 | ||
| 131 | }); | 148 | }); |
| @@ -499,7 +516,7 @@ | @@ -499,7 +516,7 @@ | ||
| 499 | <div class="uk-grid"> | 516 | <div class="uk-grid"> |
| 500 | <div class="uk-width-2-2"> | 517 | <div class="uk-width-2-2"> |
| 501 | <div class="uk-form-row"> | 518 | <div class="uk-form-row"> |
| 502 | - <img src="{{image}}" width="100%"> | 519 | + <img src="{{image}}" width="100%"> |
| 503 | </div> | 520 | </div> |
| 504 | </div> | 521 | </div> |
| 505 | </div> | 522 | </div> |
| @@ -510,6 +527,15 @@ | @@ -510,6 +527,15 @@ | ||
| 510 | </div> | 527 | </div> |
| 511 | </div> | 528 | </div> |
| 512 | </div> | 529 | </div> |
| 530 | + <div class="uk-grid"> | ||
| 531 | + <div class="uk-width-4-2"> | ||
| 532 | + <div class="uk-form-row"> | ||
| 533 | + <label class="uk-form-labels" ><h3>空闲车辆/人员</h3></label> | ||
| 534 | + <div id="nbbms"> | ||
| 535 | + </div> | ||
| 536 | + </div> | ||
| 537 | + </div> | ||
| 538 | + </div> | ||
| 513 | </div> | 539 | </div> |
| 514 | </script> | 540 | </script> |
| 515 | 541 |