Commit dd63f6bb69d054ccd29da18473513e02a9ef825d
1 parent
2fdcc1f2
司售卡匹配驾驶员或售票员
Showing
4 changed files
with
31 additions
and
7 deletions
src/main/java/com/example/demo/SaticScheduleTask.java
| @@ -40,7 +40,7 @@ public class SaticScheduleTask implements InitializingBean { | @@ -40,7 +40,7 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 40 | 40 | ||
| 41 | 41 | ||
| 42 | public Map<String,List<Scheduling>> getSchedulingS; | 42 | public Map<String,List<Scheduling>> getSchedulingS; |
| 43 | - | 43 | + public Map<String,List<Scheduling>> getSchedulingSSell; |
| 44 | public List<Map> data=new ArrayList<>(); | 44 | public List<Map> data=new ArrayList<>(); |
| 45 | 45 | ||
| 46 | /** | 46 | /** |
| @@ -87,7 +87,7 @@ public class SaticScheduleTask implements InitializingBean { | @@ -87,7 +87,7 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 87 | /* DateTimeFormatter tdf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); | 87 | /* DateTimeFormatter tdf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm"); |
| 88 | now=LocalDateTime.parse("2021-07-11 00:00",tdf);*/ | 88 | now=LocalDateTime.parse("2021-07-11 00:00",tdf);*/ |
| 89 | 89 | ||
| 90 | - this.getSchedulingS=contrast.getSchedulingS(now,1); | 90 | + contrast.getSchedulingS(now,1); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | 93 | ||
| @@ -104,7 +104,7 @@ public class SaticScheduleTask implements InitializingBean { | @@ -104,7 +104,7 @@ public class SaticScheduleTask implements InitializingBean { | ||
| 104 | LocalDateTime now=LocalDateTime.parse("2021-08-01 00:00",tdf); | 104 | LocalDateTime now=LocalDateTime.parse("2021-08-01 00:00",tdf); |
| 105 | 105 | ||
| 106 | int day=1; | 106 | int day=1; |
| 107 | - this.getSchedulingS=contrast.getSchedulingS(now,day); | 107 | + contrast.getSchedulingS(now,day); |
| 108 | 108 | ||
| 109 | Map<String,Object> map=new HashMap<>(); | 109 | Map<String,Object> map=new HashMap<>(); |
| 110 | map.put("table","pd_control."+"ftj20210806"); | 110 | map.put("table","pd_control."+"ftj20210806"); |
src/main/java/com/example/demo/model/Scheduling.java
| @@ -33,6 +33,24 @@ public class Scheduling implements Comparable<Scheduling> ,Cloneable{ | @@ -33,6 +33,24 @@ public class Scheduling implements Comparable<Scheduling> ,Cloneable{ | ||
| 33 | private String station_route_code; | 33 | private String station_route_code; |
| 34 | private String station_name; | 34 | private String station_name; |
| 35 | private String station_code; | 35 | private String station_code; |
| 36 | + private String s_gh;//售票员员工号 | ||
| 37 | + private String s_name;//售票员名字 | ||
| 38 | + | ||
| 39 | + public String getS_gh() { | ||
| 40 | + return s_gh; | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + public void setS_gh(String s_gh) { | ||
| 44 | + this.s_gh = s_gh; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public String getS_name() { | ||
| 48 | + return s_name; | ||
| 49 | + } | ||
| 50 | + | ||
| 51 | + public void setS_name(String s_name) { | ||
| 52 | + this.s_name = s_name; | ||
| 53 | + } | ||
| 36 | 54 | ||
| 37 | public String getGs_name() { | 55 | public String getGs_name() { |
| 38 | return gs_name; | 56 | return gs_name; |
src/main/java/com/example/demo/service/Contrast.java
| @@ -76,11 +76,10 @@ public class Contrast { | @@ -76,11 +76,10 @@ public class Contrast { | ||
| 76 | /** | 76 | /** |
| 77 | * @Description:车辆、排班、进出站、路由的关联及预加载 | 77 | * @Description:车辆、排班、进出站、路由的关联及预加载 |
| 78 | * @Param: now加载的最终时间 day加载几天 | 78 | * @Param: now加载的最终时间 day加载几天 |
| 79 | - * @return: 关联后的结果集 | ||
| 80 | * @Author: YM | 79 | * @Author: YM |
| 81 | * @Date: 2021/10/12 | 80 | * @Date: 2021/10/12 |
| 82 | */ | 81 | */ |
| 83 | - public Map<String,List<Scheduling>> getSchedulingS(LocalDateTime now,int day) { | 82 | + public void getSchedulingS(LocalDateTime now,int day) { |
| 84 | List<Scheduling> schedulingS=new ArrayList<>(); | 83 | List<Scheduling> schedulingS=new ArrayList<>(); |
| 85 | long start = System.currentTimeMillis(); | 84 | long start = System.currentTimeMillis(); |
| 86 | Map map = new HashMap(); | 85 | Map map = new HashMap(); |
| @@ -177,10 +176,10 @@ public class Contrast { | @@ -177,10 +176,10 @@ public class Contrast { | ||
| 177 | } | 176 | } |
| 178 | } | 177 | } |
| 179 | 178 | ||
| 180 | - Map<String,List<Scheduling>> result= schedulingS.stream().collect(Collectors.groupingBy(s->s.getJ_name())); | 179 | + saticScheduleTask.getSchedulingS= schedulingS.stream().collect(Collectors.groupingBy(s->s.getJ_name())); |
| 180 | + saticScheduleTask.getSchedulingSSell=schedulingS.stream().collect(Collectors.groupingBy(s->s.getS_name())); | ||
| 181 | 181 | ||
| 182 | logger.warn("======匹配"+arrivalInfoList.size()+"条======匹配成功 "+b+"条=====耗时=="+(System.currentTimeMillis() - start)/1000 + "秒"); | 182 | logger.warn("======匹配"+arrivalInfoList.size()+"条======匹配成功 "+b+"条=====耗时=="+(System.currentTimeMillis() - start)/1000 + "秒"); |
| 183 | - return result; | ||
| 184 | } | 183 | } |
| 185 | 184 | ||
| 186 | 185 | ||
| @@ -197,6 +196,7 @@ public class Contrast { | @@ -197,6 +196,7 @@ public class Contrast { | ||
| 197 | long start = System.currentTimeMillis(); | 196 | long start = System.currentTimeMillis(); |
| 198 | List<Map> driverCardList = getDriverCardList();//获取司机信息 | 197 | List<Map> driverCardList = getDriverCardList();//获取司机信息 |
| 199 | Map<String,List<Scheduling>> schedulingS =saticScheduleTask.getSchedulingS; | 198 | Map<String,List<Scheduling>> schedulingS =saticScheduleTask.getSchedulingS; |
| 199 | + Map<String,List<Scheduling>> schedulingSSell =saticScheduleTask.getSchedulingSSell; | ||
| 200 | DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); | 200 | DateTimeFormatter dtf=DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); |
| 201 | int b=0;//用于计算匹配成功的数量 | 201 | int b=0;//用于计算匹配成功的数量 |
| 202 | for (int i = 0; i < allData.size(); i++) { | 202 | for (int i = 0; i < allData.size(); i++) { |
| @@ -223,6 +223,10 @@ public class Contrast { | @@ -223,6 +223,10 @@ public class Contrast { | ||
| 223 | 223 | ||
| 224 | //通过司机姓名获得进出记录 | 224 | //通过司机姓名获得进出记录 |
| 225 | List<Scheduling> schedulingList1=schedulingS.get(personalName); | 225 | List<Scheduling> schedulingList1=schedulingS.get(personalName); |
| 226 | + //没匹配到匹配售票员 | ||
| 227 | + if(schedulingList1==null){ | ||
| 228 | + schedulingList1=schedulingSSell.get(personalName); | ||
| 229 | + } | ||
| 226 | Scheduling scheduling = null; | 230 | Scheduling scheduling = null; |
| 227 | 231 | ||
| 228 | 232 |