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,7 +18,7 @@ public interface SubjectUserRepository extends BaseRepository<SubjectUser, Integ | ||
| 18 | @Transactional | 18 | @Transactional |
| 19 | @Modifying | 19 | @Modifying |
| 20 | @Query(value = "update SubjectUser su set su.result =?1,su.updateBy = ?2,su.updateDate = ?3 where su.id =?4") | 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 | @Query(value="select su.user_id,su.rq,su.result,u.name,u.user_name " | 23 | @Query(value="select su.user_id,su.rq,su.result,u.name,u.user_name " |
| 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 ) " | 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 | package com.bsth.service.subject.impl; | 1 | package com.bsth.service.subject.impl; |
| 2 | 2 | ||
| 3 | +import com.bsth.data.directive.DayOfDirectives; | ||
| 3 | import com.bsth.data.schedule.DayOfSchedule; | 4 | import com.bsth.data.schedule.DayOfSchedule; |
| 4 | import com.bsth.entity.Line; | 5 | import com.bsth.entity.Line; |
| 6 | +import com.bsth.entity.directive.D60; | ||
| 5 | import com.bsth.entity.realcontrol.ScheduleRealInfo; | 7 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 6 | import com.bsth.entity.subject.Subject; | 8 | import com.bsth.entity.subject.Subject; |
| 7 | import com.bsth.entity.subject.SubjectUser; | 9 | import com.bsth.entity.subject.SubjectUser; |
| @@ -14,6 +16,7 @@ import com.bsth.service.ddexam.impl.DdexamServiceImpl; | @@ -14,6 +16,7 @@ import com.bsth.service.ddexam.impl.DdexamServiceImpl; | ||
| 14 | import com.bsth.service.impl.BaseServiceImpl; | 16 | import com.bsth.service.impl.BaseServiceImpl; |
| 15 | import com.bsth.service.subject.SubjectUserService; | 17 | import com.bsth.service.subject.SubjectUserService; |
| 16 | import com.bsth.util.subject.subEnum; | 18 | import com.bsth.util.subject.subEnum; |
| 19 | +import com.bsth.util.subject.subEnumDevice; | ||
| 17 | import org.slf4j.Logger; | 20 | import org.slf4j.Logger; |
| 18 | import org.slf4j.LoggerFactory; | 21 | import org.slf4j.LoggerFactory; |
| 19 | import org.springframework.beans.factory.annotation.Autowired; | 22 | import org.springframework.beans.factory.annotation.Autowired; |
| @@ -43,6 +46,9 @@ public class SubjectUserServiceImpl extends BaseServiceImpl<SubjectUser, Integer | @@ -43,6 +46,9 @@ public class SubjectUserServiceImpl extends BaseServiceImpl<SubjectUser, Integer | ||
| 43 | @Autowired | 46 | @Autowired |
| 44 | DdexamServiceImpl ddexamService; | 47 | DdexamServiceImpl ddexamService; |
| 45 | 48 | ||
| 49 | + @Autowired | ||
| 50 | + DayOfDirectives dayOfDirectives; | ||
| 51 | + | ||
| 46 | 52 | ||
| 47 | public List<SubjectUser> userAll(){ | 53 | public List<SubjectUser> userAll(){ |
| 48 | SysUser user = SecurityUtils.getCurrentUser(); | 54 | SysUser user = SecurityUtils.getCurrentUser(); |
| @@ -74,14 +80,25 @@ public class SubjectUserServiceImpl extends BaseServiceImpl<SubjectUser, Integer | @@ -74,14 +80,25 @@ public class SubjectUserServiceImpl extends BaseServiceImpl<SubjectUser, Integer | ||
| 74 | 80 | ||
| 75 | //类型 | 81 | //类型 |
| 76 | String type = sur.getSubjectId().getType(); | 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 | List<ScheduleRealInfo> sh = sch.stream().filter(s -> s.getXlDir().equals(sur.getSubjectId().getDir())).collect(Collectors.toList()); | 89 | List<ScheduleRealInfo> sh = sch.stream().filter(s -> s.getXlDir().equals(sur.getSubjectId().getDir())).collect(Collectors.toList()); |
| 82 | result = sjm.run(sur,sh) == true ? "0" : "1"; | 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 | result = sjm.run(sur,sch) == true ? "0" : "1"; | 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 | SimpleDateFormat formatter = new SimpleDateFormat ("yyyy-MM-dd HH:mm:ss"); | 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,7 +172,7 @@ public enum subEnum { | ||
| 172 | return false; | 172 | return false; |
| 173 | } | 173 | } |
| 174 | }, | 174 | }, |
| 175 | - //直放 | 175 | + //放站 |
| 176 | fz { | 176 | fz { |
| 177 | @Override | 177 | @Override |
| 178 | public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch) { | 178 | public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch) { |
| @@ -191,7 +191,7 @@ public enum subEnum { | @@ -191,7 +191,7 @@ public enum subEnum { | ||
| 191 | return false; | 191 | return false; |
| 192 | } | 192 | } |
| 193 | }, | 193 | }, |
| 194 | - //直放 | 194 | + //子任务 |
| 195 | zrw { | 195 | zrw { |
| 196 | @Override | 196 | @Override |
| 197 | public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch) { | 197 | public boolean run(SubjectUser sur, List<ScheduleRealInfo> sch) { |
| @@ -235,7 +235,6 @@ public enum subEnum { | @@ -235,7 +235,6 @@ public enum subEnum { | ||
| 235 | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); | 235 | SimpleDateFormat sdf = new SimpleDateFormat("HH:mm"); |
| 236 | //排序 | 236 | //排序 |
| 237 | Collections.sort(sch, new ScheduleComparator.DFSJ2()); | 237 | Collections.sort(sch, new ScheduleComparator.DFSJ2()); |
| 238 | - int su = 0; | ||
| 239 | try{ | 238 | try{ |
| 240 | //判断结果是否合格 | 239 | //判断结果是否合格 |
| 241 | String df = ""; | 240 | String df = ""; |
| @@ -320,6 +319,7 @@ public enum subEnum { | @@ -320,6 +319,7 @@ public enum subEnum { | ||
| 320 | //判断当前班次是否符合条件 全部班次 | 319 | //判断当前班次是否符合条件 全部班次 |
| 321 | if ( s.getBcType().equals(t[0]) && s.isSflj() == true && s.getClZbh().equals(t[2]) && | 320 | if ( s.getBcType().equals(t[0]) && s.isSflj() == true && s.getClZbh().equals(t[2]) && |
| 322 | (s.getDfsj().equals(sj) || s.getDfsj().equals(t[1]) )) { | 321 | (s.getDfsj().equals(sj) || s.getDfsj().equals(t[1]) )) { |
| 322 | + | ||
| 323 | if((s.getQdzName().equals(t[3]) && s.getZdzName().equals(t[4]) ) || | 323 | if((s.getQdzName().equals(t[3]) && s.getZdzName().equals(t[4]) ) || |
| 324 | s.getQdzName().equals(t[4]) && s.getZdzName().equals(t[3])){ | 324 | s.getQdzName().equals(t[4]) && s.getZdzName().equals(t[3])){ |
| 325 | nts++; | 325 | nts++; |
| @@ -441,18 +441,59 @@ public enum subEnum { | @@ -441,18 +441,59 @@ public enum subEnum { | ||
| 441 | int su = 0; | 441 | int su = 0; |
| 442 | try{ | 442 | try{ |
| 443 | //判断结果是否合格 | 443 | //判断结果是否合格 |
| 444 | + int sunm = 0; | ||
| 444 | for (int i = 0; i < sch.size(); i++) { | 445 | for (int i = 0; i < sch.size(); i++) { |
| 445 | ScheduleRealInfo s = sch.get(i); | 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 | return true; | 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,6 +32,7 @@ | ||
| 32 | <tr> | 32 | <tr> |
| 33 | <td>序号</td> | 33 | <td>序号</td> |
| 34 | <td>考生账号</td> | 34 | <td>考生账号</td> |
| 35 | + <td>考生名称</td> | ||
| 35 | <td>考生们密码</td> | 36 | <td>考生们密码</td> |
| 36 | <td>考生状态</td> | 37 | <td>考生状态</td> |
| 37 | </tr> | 38 | </tr> |
| @@ -68,6 +69,7 @@ | @@ -68,6 +69,7 @@ | ||
| 68 | {{i+1}} | 69 | {{i+1}} |
| 69 | </td> | 70 | </td> |
| 70 | <td>{{obj.userName}}</td> | 71 | <td>{{obj.userName}}</td> |
| 72 | + <td>{{obj.name}}</td> | ||
| 71 | <td>123456</td> | 73 | <td>123456</td> |
| 72 | <td> | 74 | <td> |
| 73 | {{if obj.ksstatus=="1"}}已初始化{{else}}未初始化{{/if}} | 75 | {{if obj.ksstatus=="1"}}已初始化{{else}}未初始化{{/if}} |
src/main/resources/static/real_control_v2/js/subject/subject.js
| @@ -3,11 +3,7 @@ var su_subject = (function () { | @@ -3,11 +3,7 @@ var su_subject = (function () { | ||
| 3 | 3 | ||
| 4 | var $wrap = $('.uk-panels'); | 4 | var $wrap = $('.uk-panels'); |
| 5 | var init =function(cb) { | 5 | var init =function(cb) { |
| 6 | - | ||
| 7 | ks(); | 6 | ks(); |
| 8 | - | ||
| 9 | - | ||
| 10 | - | ||
| 11 | }; | 7 | }; |
| 12 | 8 | ||
| 13 | function ks(){ | 9 | function ks(){ |
src/main/resources/static/real_control_v2/main.html
| @@ -79,7 +79,7 @@ | @@ -79,7 +79,7 @@ | ||
| 79 | 场景:{{subjectId.subjectText}} | 79 | 场景:{{subjectId.subjectText}} |
| 80 | </div> | 80 | </div> |
| 81 | <div class="north-tmx"> | 81 | <div class="north-tmx"> |
| 82 | - 操作:{{subjectId.operateTest}} | 82 | + 操作:({{subjectId.dir == 0 ? '上行':'下行'}}){{subjectId.operateTest}} |
| 83 | </div> | 83 | </div> |
| 84 | <div class="north-button"> | 84 | <div class="north-button"> |
| 85 | <button id="submit" class="subject_button" data-id="{{id}}">提交</button> | 85 | <button id="submit" class="subject_button" data-id="{{id}}">提交</button> |