Commit ba3e036fcea78881f449eace98e03acc34a68443
1 parent
68bc04ff
20223-10-24 20个场景初步完成
Showing
7 changed files
with
143 additions
and
20 deletions
src/main/java/com/bsth/repository/subject/SubjectUserRepository.java
| ... | ... | @@ -18,7 +18,7 @@ public interface SubjectUserRepository extends BaseRepository<SubjectUser, Integ |
| 18 | 18 | @Transactional |
| 19 | 19 | @Modifying |
| 20 | 20 | @Query(value = "update SubjectUser su set su.result =?1,su.updateBy = ?2,su.updateDate = ?3 where su.id =?4") |
| 21 | - int updates(String rq, Integer id, Date updateDate, Integer userId); | |
| 21 | + int updates(String result, Integer id, Date updateDate, Integer userId); | |
| 22 | 22 | |
| 23 | 23 | @Query(value="select su.user_id,su.rq,su.result,u.name,u.user_name " |
| 24 | 24 | + " from bsth_subject_user su,bsth_c_sys_user u where su.user_id =u.id and su.rq =?1 and su.user_id in ( ?2 ) " | ... | ... |
src/main/java/com/bsth/service/subject/impl/SubjectUserServiceImpl.java
| 1 | 1 | package com.bsth.service.subject.impl; |
| 2 | 2 | |
| 3 | +import com.bsth.data.directive.DayOfDirectives; | |
| 3 | 4 | import com.bsth.data.schedule.DayOfSchedule; |
| 4 | 5 | import com.bsth.entity.Line; |
| 6 | +import com.bsth.entity.directive.D60; | |
| 5 | 7 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | 8 | import com.bsth.entity.subject.Subject; |
| 7 | 9 | import com.bsth.entity.subject.SubjectUser; |
| ... | ... | @@ -14,6 +16,7 @@ import com.bsth.service.ddexam.impl.DdexamServiceImpl; |
| 14 | 16 | import com.bsth.service.impl.BaseServiceImpl; |
| 15 | 17 | import com.bsth.service.subject.SubjectUserService; |
| 16 | 18 | import com.bsth.util.subject.subEnum; |
| 19 | +import com.bsth.util.subject.subEnumDevice; | |
| 17 | 20 | import org.slf4j.Logger; |
| 18 | 21 | import org.slf4j.LoggerFactory; |
| 19 | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| ... | ... | @@ -43,6 +46,9 @@ public class SubjectUserServiceImpl extends BaseServiceImpl<SubjectUser, Integer |
| 43 | 46 | @Autowired |
| 44 | 47 | DdexamServiceImpl ddexamService; |
| 45 | 48 | |
| 49 | + @Autowired | |
| 50 | + DayOfDirectives dayOfDirectives; | |
| 51 | + | |
| 46 | 52 | |
| 47 | 53 | public List<SubjectUser> userAll(){ |
| 48 | 54 | SysUser user = SecurityUtils.getCurrentUser(); |
| ... | ... | @@ -74,14 +80,25 @@ public class SubjectUserServiceImpl extends BaseServiceImpl<SubjectUser, Integer |
| 74 | 80 | |
| 75 | 81 | //类型 |
| 76 | 82 | String type = sur.getSubjectId().getType(); |
| 77 | - //判断答题是否正确 | |
| 78 | - subEnum sjm = subEnum.valueOf(type); | |
| 79 | - String result; | |
| 80 | - if (sur.getSubjectId().getSchStatus().equals("0")){ | |
| 83 | + | |
| 84 | + | |
| 85 | + String result = null; | |
| 86 | + if (sur.getSubjectId().getSchStatus().equals("0")){ //区分上下行的班次数据 | |
| 87 | + //判断答题是否正确 | |
| 88 | + subEnum sjm = subEnum.valueOf(type); | |
| 81 | 89 | List<ScheduleRealInfo> sh = sch.stream().filter(s -> s.getXlDir().equals(sur.getSubjectId().getDir())).collect(Collectors.toList()); |
| 82 | 90 | result = sjm.run(sur,sh) == true ? "0" : "1"; |
| 83 | - }else { | |
| 91 | + }if (sur.getSubjectId().getSchStatus().equals("1")) {//全量的班次数据 | |
| 92 | + //判断答题是否正确 | |
| 93 | + subEnum sjm = subEnum.valueOf(type); | |
| 84 | 94 | result = sjm.run(sur,sch) == true ? "0" : "1"; |
| 95 | + }if (sur.getSubjectId().getSchStatus().equals("2")) { //与设备对接的 | |
| 96 | + subEnumDevice sjmdrivce = subEnumDevice.valueOf(type); | |
| 97 | + | |
| 98 | + //运营指令 | |
| 99 | + Collection<D60> yyArray = dayOfDirectives.all60();//查看当日缓存指令 | |
| 100 | + | |
| 101 | + result = sjmdrivce.run(sur,yyArray,user) == true ? "0" : "1"; | |
| 85 | 102 | } |
| 86 | 103 | |
| 87 | 104 | SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | ... | ... |
src/main/java/com/bsth/util/subject/subEnum.java
| ... | ... | @@ -172,7 +172,7 @@ public enum subEnum { |
| 172 | 172 | return false; |
| 173 | 173 | } |
| 174 | 174 | }, |
| 175 | - //直放 | |
| 175 | + //放站 | |
| 176 | 176 | fz { |
| 177 | 177 | @Override |
| 178 | 178 | public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch) { |
| ... | ... | @@ -191,7 +191,7 @@ public enum subEnum { |
| 191 | 191 | return false; |
| 192 | 192 | } |
| 193 | 193 | }, |
| 194 | - //直放 | |
| 194 | + //子任务 | |
| 195 | 195 | zrw { |
| 196 | 196 | @Override |
| 197 | 197 | public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch) { |
| ... | ... | @@ -235,7 +235,6 @@ public enum subEnum { |
| 235 | 235 | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| 236 | 236 | //排序 |
| 237 | 237 | Collections.sort(sch, new ScheduleComparator.DFSJ2()); |
| 238 | - int su = 0; | |
| 239 | 238 | try{ |
| 240 | 239 | //判断结果是否合格 |
| 241 | 240 | String df = ""; |
| ... | ... | @@ -320,6 +319,7 @@ public enum subEnum { |
| 320 | 319 | //判断当前班次是否符合条件 全部班次 |
| 321 | 320 | if ( s.getBcType().equals(t[0]) && s.isSflj() == true && s.getClZbh().equals(t[2]) && |
| 322 | 321 | (s.getDfsj().equals(sj) || s.getDfsj().equals(t[1]) )) { |
| 322 | + | |
| 323 | 323 | if((s.getQdzName().equals(t[3]) && s.getZdzName().equals(t[4]) ) || |
| 324 | 324 | s.getQdzName().equals(t[4]) && s.getZdzName().equals(t[3])){ |
| 325 | 325 | nts++; |
| ... | ... | @@ -441,18 +441,59 @@ public enum subEnum { |
| 441 | 441 | int su = 0; |
| 442 | 442 | try{ |
| 443 | 443 | //判断结果是否合格 |
| 444 | + int sunm = 0; | |
| 444 | 445 | for (int i = 0; i < sch.size(); i++) { |
| 445 | 446 | ScheduleRealInfo s = sch.get(i); |
| 446 | - //判断当前班次是否符合条件 | |
| 447 | - if ( s.getDfsj().equals(sj) && s.getjGh().equals(t[1])) { | |
| 448 | - su ++; | |
| 447 | + if ( s.getDfsj().equals(sj)) { //当前排班 | |
| 448 | + su = i; | |
| 449 | + } | |
| 450 | + //后续两个班次 | |
| 451 | + if (su != 0 && i > su && i <= su + 3){ | |
| 452 | + Long stn = sdf.parse(s.getDfsj()).getTime() - sdf.parse(s.getFcsj()).getTime(); | |
| 453 | + int stg = stn.intValue() / 60 / 1000; | |
| 454 | + sunm = stg == Integer.parseInt(t[0]) ? sunm + 1 : sunm; // | |
| 449 | 455 | } |
| 456 | + } | |
| 457 | + if(sunm == 3) | |
| 458 | + return true; | |
| 450 | 459 | |
| 451 | - if ( s.getDfsj().equals(t[2]) && s.getjGh().equals(t[0])) { | |
| 452 | - su ++; | |
| 460 | + | |
| 461 | + }catch (Exception e){ | |
| 462 | + e.printStackTrace(); | |
| 463 | + } | |
| 464 | + | |
| 465 | + return false; | |
| 466 | + } | |
| 467 | + }, | |
| 468 | + | |
| 469 | + //批量误点调整 | |
| 470 | + pwd{ | |
| 471 | + @Override | |
| 472 | + public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch){ | |
| 473 | + String sj = sur.getSubjectId().getFcsj();//计划发车时间 | |
| 474 | + String answer = sur.getSubjectId().getAnswer();//答案 | |
| 475 | + String[] t = answer.split(","); //0 | |
| 476 | + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | |
| 477 | + //排序 | |
| 478 | + Collections.sort(sch, new ScheduleComparator.DFSJ2()); | |
| 479 | + int su = 0; | |
| 480 | + try{ | |
| 481 | + //判断结果是否合格 | |
| 482 | + int sunm = 0; | |
| 483 | + for (int i = 0; i < sch.size(); i++) { | |
| 484 | + ScheduleRealInfo s = sch.get(i); | |
| 485 | + if ( s.getDfsj().equals(sj)) { //当前排班 | |
| 486 | + Float stn = s.getLateMinute(); | |
| 487 | + sunm = stn == Integer.parseInt(t[0]) ? sunm + 1 : sunm; //班次调整待发延后10分 | |
| 488 | + su = i; | |
| 489 | + } | |
| 490 | + //后续两个班次 | |
| 491 | + if (su != 0 && i > su && i <= su + 2){ | |
| 492 | + Float stn = s.getLateMinute(); | |
| 493 | + sunm = stn == Integer.parseInt(t[0]) ? sunm + 1 : sunm; //班次调整待发延后10分 | |
| 453 | 494 | } |
| 454 | 495 | } |
| 455 | - if(su == 2) | |
| 496 | + if(sunm == 3) | |
| 456 | 497 | return true; |
| 457 | 498 | |
| 458 | 499 | ... | ... |
src/main/java/com/bsth/util/subject/subEnumDevice.java
0 → 100644
| 1 | +package com.bsth.util.subject; | |
| 2 | + | |
| 3 | +import com.bsth.data.schedule.ScheduleComparator; | |
| 4 | +import com.bsth.entity.directive.D60; | |
| 5 | +import com.bsth.entity.realcontrol.ChildTaskPlan; | |
| 6 | +import com.bsth.entity.realcontrol.ScheduleRealInfo; | |
| 7 | +import com.bsth.entity.subject.SubjectUser; | |
| 8 | +import com.bsth.entity.sys.SysUser; | |
| 9 | + | |
| 10 | +import java.text.SimpleDateFormat; | |
| 11 | +import java.util.Collection; | |
| 12 | +import java.util.Collections; | |
| 13 | +import java.util.List; | |
| 14 | +import java.util.Set; | |
| 15 | +import java.util.stream.Collectors; | |
| 16 | + | |
| 17 | +public enum subEnumDevice { | |
| 18 | + | |
| 19 | + | |
| 20 | + //手动切换车辆方向 | |
| 21 | + qdir{ | |
| 22 | + @Override | |
| 23 | + public boolean run(SubjectUser sur, Collection<D60> yyArray,SysUser user){ | |
| 24 | + for (D60 d60 : yyArray){ | |
| 25 | + if (d60.getSender().equals(user.getUserName())){ //用户名 | |
| 26 | + if(d60.getData().getTxtContent().equals("切换为 下行营运")){ | |
| 27 | + return true; | |
| 28 | + } | |
| 29 | + } | |
| 30 | + } | |
| 31 | + return false; | |
| 32 | + } | |
| 33 | + }, | |
| 34 | + //手动切换车辆方向 | |
| 35 | + xf{ | |
| 36 | + @Override | |
| 37 | + public boolean run(SubjectUser sur, Collection<D60> yyArray,SysUser user){ | |
| 38 | + String answer = sur.getSubjectId().getAnswer();//答案 | |
| 39 | + String[] t = answer.split(","); //0 | |
| 40 | + for (D60 d60 : yyArray){ | |
| 41 | + if (d60.getDeviceId().contains(user.getUserName()) && d60.getDeviceId().contains(t[0]) ){ //用户名 | |
| 42 | + return true; | |
| 43 | + } | |
| 44 | + } | |
| 45 | + return false; | |
| 46 | + } | |
| 47 | + }, | |
| 48 | + //手动切换车辆方向 | |
| 49 | + pxf{ | |
| 50 | + @Override | |
| 51 | + public boolean run(SubjectUser sur, Collection<D60> yyArray,SysUser user){ | |
| 52 | + int num = 0; | |
| 53 | + for (D60 d60 : yyArray){ | |
| 54 | + if (d60.getDeviceId().contains(user.getUserName())){ //用户名 | |
| 55 | + num = num + 1; | |
| 56 | + } | |
| 57 | + } | |
| 58 | + if (num >= 5) | |
| 59 | + return true; | |
| 60 | + | |
| 61 | + return false; | |
| 62 | + } | |
| 63 | + }; | |
| 64 | + | |
| 65 | + | |
| 66 | + public abstract boolean run(SubjectUser sur, Collection<D60> yyArray, SysUser user); | |
| 67 | +} | ... | ... |
src/main/resources/static/pages/ddexam/list.html
| ... | ... | @@ -32,6 +32,7 @@ |
| 32 | 32 | <tr> |
| 33 | 33 | <td>序号</td> |
| 34 | 34 | <td>考生账号</td> |
| 35 | + <td>考生名称</td> | |
| 35 | 36 | <td>考生们密码</td> |
| 36 | 37 | <td>考生状态</td> |
| 37 | 38 | </tr> |
| ... | ... | @@ -68,6 +69,7 @@ |
| 68 | 69 | {{i+1}} |
| 69 | 70 | </td> |
| 70 | 71 | <td>{{obj.userName}}</td> |
| 72 | + <td>{{obj.name}}</td> | |
| 71 | 73 | <td>123456</td> |
| 72 | 74 | <td> |
| 73 | 75 | {{if obj.ksstatus=="1"}}已初始化{{else}}未初始化{{/if}} | ... | ... |
src/main/resources/static/real_control_v2/js/subject/subject.js
src/main/resources/static/real_control_v2/main.html
| ... | ... | @@ -79,7 +79,7 @@ |
| 79 | 79 | 场景:{{subjectId.subjectText}} |
| 80 | 80 | </div> |
| 81 | 81 | <div class="north-tmx"> |
| 82 | - 操作:{{subjectId.operateTest}} | |
| 82 | + 操作:({{subjectId.dir == 0 ? '上行':'下行'}}){{subjectId.operateTest}} | |
| 83 | 83 | </div> |
| 84 | 84 | <div class="north-button"> |
| 85 | 85 | <button id="submit" class="subject_button" data-id="{{id}}">提交</button> | ... | ... |