Commit 3e76e1e54776f92cc0a283dd6abe6f93e572cda4

Authored by 廖磊
2 parents 84a0f33f 7a40065f

Merge branch 'minhang' of

http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
Showing 26 changed files with 347 additions and 870 deletions

Too many changes to show.

To preserve performance only 26 of 33 files are displayed.

src/main/java/com/bsth/Application.java
@@ -8,14 +8,16 @@ import org.springframework.boot.builder.SpringApplicationBuilder; @@ -8,14 +8,16 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
8 import org.springframework.boot.context.web.SpringBootServletInitializer; 8 import org.springframework.boot.context.web.SpringBootServletInitializer;
9 import org.springframework.context.annotation.Bean; 9 import org.springframework.context.annotation.Bean;
10 import org.springframework.context.annotation.Primary; 10 import org.springframework.context.annotation.Primary;
  11 +import org.springframework.transaction.annotation.EnableTransactionManagement;
11 12
12 import java.util.concurrent.Executors; 13 import java.util.concurrent.Executors;
13 import java.util.concurrent.ScheduledExecutorService; 14 import java.util.concurrent.ScheduledExecutorService;
14 15
  16 +@EnableTransactionManagement
15 @SpringBootApplication 17 @SpringBootApplication
16 public class Application extends SpringBootServletInitializer { 18 public class Application extends SpringBootServletInitializer {
17 19
18 - public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(13); 20 + public static ScheduledExecutorService mainServices = Executors.newScheduledThreadPool(14);
19 21
20 @Override 22 @Override
21 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 23 protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
src/main/java/com/bsth/data/BasicData.java
@@ -40,7 +40,7 @@ public class BasicData implements CommandLineRunner { @@ -40,7 +40,7 @@ public class BasicData implements CommandLineRunner {
40 //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码) 40 //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:公司代码)
41 public static Map<String, String> nbbm2CompanyCodeMap; 41 public static Map<String, String> nbbm2CompanyCodeMap;
42 42
43 - //车辆自编号和公司代码对照 (K: 车辆自编号 ,V:牌照号) 43 + //车辆自编号和牌照号对照 (K: 车辆自编号 ,V:牌照号)
44 public static Map<String, String> nbbmCompanyPlateMap; 44 public static Map<String, String> nbbmCompanyPlateMap;
45 45
46 //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称) 46 //站点编码和名称对照,包括停车场 (K: lineCode_updown_stationCode ,V:站点名称)
src/main/java/com/bsth/data/arrival/AnalyseData.java deleted 100644 → 0
1 -package com.bsth.data.arrival;  
2 -  
3 -import org.slf4j.Logger;  
4 -import org.slf4j.LoggerFactory;  
5 -import org.springframework.stereotype.Component;  
6 -  
7 -import java.util.ArrayList;  
8 -import java.util.Collections;  
9 -import java.util.List;  
10 -import java.util.Set;  
11 -  
12 -/**  
13 - *  
14 - * @ClassName: AnalyseArrivalData  
15 - * @Description: TODO(分析一下进出站场数据)  
16 - * @author PanZhao  
17 - * @date 2016年8月24日 上午11:09:37  
18 - *  
19 - */  
20 -@Component  
21 -public class AnalyseData {  
22 -  
23 - Logger logger = LoggerFactory.getLogger(AnalyseData.class);  
24 -  
25 - public void analyse(Set<String> cars){  
26 - try{  
27 - List<ArrivalEntity> list, clearList;  
28 - for(String car : cars){  
29 - list = ArrivalData_GPS.findByNbbm(car);  
30 - analyse(list);  
31 -  
32 - //清理掉无效的点  
33 - clearList = new ArrayList<>();  
34 - for(ArrivalEntity arr : list){  
35 - if(!arr.isEnable())  
36 - clearList.add(arr);  
37 - }  
38 - list.removeAll(clearList);  
39 - }  
40 - }catch(Exception e){  
41 - logger.error("", e);  
42 - }  
43 - }  
44 -  
45 - private final static int SHIFT_TIME = 1000 * 60 * 5,  
46 - SCH_TIME = 1000 * 60 * 10;  
47 -  
48 - static ArrivalComparator comp = new ArrivalComparator();  
49 -  
50 - public void analyse(List<ArrivalEntity> list){  
51 - if(list.size() <= 1)  
52 - return;  
53 -  
54 - //排序  
55 - Collections.sort(list, comp);  
56 - ArrivalEntity prve = list.get(0)  
57 - ,curr;  
58 - for(int i = 1; i < list.size(); i ++){  
59 - curr = list.get(i);  
60 - //如果第一个点无效  
61 - if(!effective(prve)){  
62 - prve.setEnable(false);  
63 - prve = curr;  
64 - continue;  
65 - }  
66 - //如果第二个点无效  
67 - else if(!effective(curr)){  
68 - curr.setEnable(false);  
69 - continue;  
70 - }  
71 - else if(curr.getTs() - prve.getTs() < SCH_TIME){  
72 - if(prve.getUpDown() == curr.getUpDown()){  
73 - //信号漂移,出站无效  
74 - if(curr.getStopNo().equals(prve.getStopNo())  
75 - && prve.getInOut() == 1 && curr.getInOut() == 0  
76 - && curr.getTs() - prve.getTs() < SHIFT_TIME){  
77 - prve.setEnable(false);  
78 - }  
79 -// else if(curr.getInOut()){  
80 -// //curr.getTs() - prve.getTs() < 30000  
81 -// }  
82 - }  
83 - else{  
84 - //上下行的同名站,新走向的第一个出站信号开始有效  
85 - if(prve.getStopName().equals(curr.getStopName())){  
86 - if(curr.getInOut() == 0)  
87 - curr.setEnable(false);  
88 - else  
89 - prve = curr;  
90 - }  
91 - }  
92 - }  
93 - else  
94 - prve = curr;  
95 - }  
96 - }  
97 -  
98 - private boolean effective(ArrivalEntity arr){  
99 - /*//停车场  
100 - if(BasicData.parkCodeList.contains(arr.getStopNo())){  
101 - arr.setTcc(true);  
102 - return true;  
103 - }  
104 -  
105 - Integer upDown = BasicData.lineStationUpDownMap.get(arr.getLineCode() + "_" + arr.getStopNo());  
106 -  
107 - return arr.getUpDown() == upDown || BasicData.parkCodeList.contains(arr.getStopNo());*/  
108 - return false;  
109 - }  
110 -}  
src/main/java/com/bsth/data/arrival/ArrivalData_GPS.java deleted 100644 → 0
1 -package com.bsth.data.arrival;  
2 -  
3 -import com.bsth.data.schedule.DayOfSchedule;  
4 -import com.google.common.collect.ArrayListMultimap;  
5 -import com.google.common.collect.ListMultimap;  
6 -import org.slf4j.Logger;  
7 -import org.slf4j.LoggerFactory;  
8 -import org.springframework.beans.factory.annotation.Autowired;  
9 -import org.springframework.boot.CommandLineRunner;  
10 -import org.springframework.stereotype.Component;  
11 -  
12 -import java.util.*;  
13 -  
14 -/**  
15 - *  
16 - * @ClassName: ArrivalData_GPS  
17 - * @Description: TODO(GPS到离站数据)  
18 - * @author PanZhao  
19 - * @date 2016年8月18日 下午10:05:27  
20 - *  
21 - */  
22 -@Component  
23 -public class ArrivalData_GPS implements CommandLineRunner{  
24 -  
25 - // 起终点站进出数据 K:车辆编码  
26 - private static ListMultimap<String, ArrivalEntity> startAndEndMaps;  
27 -  
28 - private static Map<String, Integer> carIndexMap;  
29 -  
30 - static{  
31 - startAndEndMaps = ArrayListMultimap.create();  
32 -  
33 - carIndexMap = new HashMap<>();  
34 - }  
35 -  
36 - @Autowired  
37 - DataLoaderThread dataLoaderThread;  
38 -  
39 - static Logger logger = LoggerFactory.getLogger(ArrivalData_GPS.class);  
40 -  
41 - @Override  
42 - public void run(String... arg0) throws Exception {  
43 - logger.info("ArrivalData_GPS,30,06");  
44 - //Application.mainServices.scheduleWithFixedDelay(dataLoaderThread, 40, 6, TimeUnit.SECONDS);  
45 - }  
46 -  
47 - @Component  
48 - public static class DataLoaderThread extends Thread {  
49 -  
50 - @Autowired  
51 - DataLoader dataLoader;  
52 -  
53 - @Autowired  
54 - DayOfSchedule dayOfSchedule;  
55 -  
56 - @Autowired  
57 - AnalyseData analyseData;  
58 -  
59 - @Override  
60 - public void run() {  
61 - /*try{  
62 - logger.info("开始加载到离站数据, " + System.currentTimeMillis());  
63 - List<ArrivalEntity> arrSets = dataLoader.load();  
64 - if(null == arrSets || arrSets.size() == 0)  
65 - return;  
66 -  
67 - //有起终点进出的车辆  
68 - Set<String> carSet = new TreeSet<>();  
69 - //按车辆起终点站过滤数据  
70 - String nbbm;  
71 - Set<String> seList;  
72 - for(ArrivalEntity arr : arrSets){  
73 - nbbm = arr.getNbbm();  
74 -  
75 - seList = dayOfSchedule.getSEStationList(nbbm);  
76 - if(seList.contains(arr.getStopNo())){  
77 - startAndEndMaps.put(nbbm, arr);  
78 - carSet.add(nbbm);  
79 - }  
80 - }  
81 - //从专业的角度分析一下数据  
82 - analyseData.analyse(carSet);  
83 -  
84 - //开始匹配  
85 - Arrival2Schedule.start(carSet);  
86 - }catch(Exception e){  
87 - logger.error("", e);  
88 - }*/  
89 - }  
90 - }  
91 -  
92 - /**  
93 - *  
94 - * @Title: clearRAMData  
95 - * @Description: TODO(清理内存数据)  
96 - */  
97 - public void clearRAMData(String lineCode){  
98 -  
99 - List<ArrivalEntity> remList = new ArrayList<>();  
100 -  
101 - //车辆映射的进出站数据,遍历删除对应线路数据。  
102 - Collection<ArrivalEntity> seList = startAndEndMaps.values();  
103 - for(ArrivalEntity arr : seList){  
104 - if(arr.getLineCode().equals(lineCode))  
105 - remList.add(arr);  
106 - }  
107 -  
108 - //删除数据  
109 - int count = 0;  
110 - for(ArrivalEntity arr : remList){  
111 - startAndEndMaps.remove(arr.getNbbm(), arr);  
112 - count ++;  
113 - }  
114 -  
115 - logger.info(lineCode + " 清除到离站数据 ," + count);  
116 - }  
117 -  
118 - public synchronized static List<ArrivalEntity> findByNbbm(String nbbm){  
119 - return startAndEndMaps.get(nbbm);  
120 - }  
121 -  
122 - public static List<ArrivalEntity> getIncrement(String nbbm){  
123 - Integer mark = null;  
124 - if (!carIndexMap.containsKey(nbbm))  
125 - mark = 0;  
126 - else  
127 - mark = carIndexMap.get(nbbm);  
128 -  
129 - List<ArrivalEntity> all = startAndEndMaps.get(nbbm);  
130 - int size = all.size();  
131 - if(size == 0)  
132 - return new ArrayList<>(0);  
133 -  
134 - List<ArrivalEntity> rs = all.subList(mark, size);  
135 - carIndexMap.put(nbbm, size);  
136 - return rs;  
137 - }  
138 -}  
139 \ No newline at end of file 0 \ No newline at end of file
src/main/java/com/bsth/data/car_out_info/CarOutInfo.java 0 → 100644
  1 +package com.bsth.data.car_out_info;
  2 +
  3 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/5/7.
  9 + */
  10 +public interface CarOutInfo {
  11 +
  12 + void updateAll();
  13 +
  14 + void update(String lineCode);
  15 +
  16 + void update(List<ScheduleRealInfo> list) ;
  17 +}
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java 0 → 100644
  1 +package com.bsth.data.car_out_info;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.schedule.DayOfSchedule;
  5 +import com.bsth.data.schedule.ScheduleComparator;
  6 +import com.bsth.entity.realcontrol.ScheduleRealInfo;
  7 +import com.google.common.collect.ArrayListMultimap;
  8 +import org.apache.commons.lang3.StringUtils;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.boot.CommandLineRunner;
  13 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  14 +import org.springframework.jdbc.core.JdbcTemplate;
  15 +import org.springframework.stereotype.Component;
  16 +import org.springframework.stereotype.Service;
  17 +import org.springframework.transaction.annotation.Transactional;
  18 +
  19 +import java.sql.PreparedStatement;
  20 +import java.sql.SQLException;
  21 +import java.util.*;
  22 +
  23 +/**
  24 + * 发车信息表处理程序
  25 + * Created by panzhao on 2017/5/5.
  26 + */
  27 +@Service
  28 +public class CarOutInfoHandler implements CommandLineRunner, CarOutInfo {
  29 +
  30 + @Autowired
  31 + DayOfSchedule dayOfSchedule;
  32 +
  33 + //班次类型对照表
  34 + Map<String, String> bcTypeMap;
  35 +
  36 + private static ScheduleComparator.FCSJ schFCSJComparator = new ScheduleComparator.FCSJ();
  37 +
  38 + @Autowired
  39 + JdbcTemplate jdbcTemplate;
  40 +
  41 + Logger logger = LoggerFactory.getLogger(this.getClass());
  42 +
  43 + /**
  44 + * 全量更新发车信息表
  45 + */
  46 + @Override
  47 + public void updateAll() {
  48 + Set<String> ks = BasicData.lineCode2NameMap.keySet();
  49 + for (String lineCode : ks) {
  50 + update(lineCode);
  51 + }
  52 + }
  53 +
  54 + @Override
  55 + public void update(String lineCode) {
  56 + try {
  57 + ArrayListMultimap<String, ScheduleRealInfo> lpScheduleMap = dayOfSchedule.getLpScheduleMap();
  58 + List<ScheduleRealInfo> list = new ArrayList<>();
  59 +
  60 + Set<String> ks = lpScheduleMap.keySet();
  61 + String prefix = lineCode + "_";
  62 + for (String k : ks) {
  63 + if (k.indexOf(prefix) != -1) {
  64 + list.addAll(lpScheduleMap.get(k));
  65 + }
  66 + }
  67 +
  68 + update(list);
  69 + } catch (Exception e) {
  70 + logger.error("", e);
  71 + }
  72 + }
  73 +
  74 + @Transactional
  75 + @Override
  76 + public void update(List<ScheduleRealInfo> list) {
  77 + if (list.size() == 0)
  78 + return;
  79 + String lineCode = list.get(0).getXlBm();
  80 + //按上下行分组
  81 + List<ScheduleRealInfo> ups = new ArrayList<>(), downs = new ArrayList<>();
  82 + for (ScheduleRealInfo sch : list) {
  83 + if (sch.getXlDir().equals("0"))
  84 + ups.add(sch);
  85 + else
  86 + downs.add(sch);
  87 + }
  88 +
  89 + ScheduleRealInfo[] upArray = nexts(ups),
  90 + downArray = nexts(downs);
  91 +
  92 + final List<ScheduleRealInfo> pstArray = mergeArray(upArray, downArray);
  93 + //删除
  94 + jdbcTemplate.update("delete from bsth_t_clfcxxb where line_code=?", lineCode);
  95 + //重新写入
  96 + jdbcTemplate.batchUpdate("insert into bsth_t_clfcxxb(rq, line_code, line_name, lp_name, lp_sn, dfsj, nbbm, cph, bc_type, end_station_name, updown, jGh, jName, remarks, sn)" +
  97 + " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
  98 + @Override
  99 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  100 + ScheduleRealInfo sch = pstArray.get(i);
  101 + ps.setString(1, sch.getScheduleDateStr());
  102 + ps.setString(2, sch.getXlBm());
  103 + ps.setString(3, sch.getXlName());
  104 + ps.setString(4, sch.getLpName());
  105 + ps.setInt(5, sch.getFcno());
  106 + ps.setString(6, sch.getDfsj());
  107 + ps.setString(7, sch.getClZbh());
  108 + ps.setString(8, BasicData.nbbmCompanyPlateMap.get(sch.getClZbh()));
  109 + ps.setString(9, bcTypeMap.containsKey(sch.getBcType()) ? bcTypeMap.get(sch.getBcType()) : sch.getBcType());
  110 + ps.setString(10, sch.getZdzName());
  111 + ps.setInt(11, Integer.parseInt(sch.getXlDir()));
  112 + ps.setString(12, sch.getjGh());
  113 + ps.setString(13, sch.getjName());
  114 + ps.setString(14, sch.getRemarks());
  115 + ps.setInt(15, sch.getFcpSn());
  116 + }
  117 +
  118 + @Override
  119 + public int getBatchSize() {
  120 + return pstArray.size();
  121 + }
  122 + });
  123 + }
  124 +
  125 + private List<ScheduleRealInfo> mergeArray(ScheduleRealInfo[] upArray, ScheduleRealInfo[] downArray) {
  126 + List<ScheduleRealInfo> list = new ArrayList<>();
  127 + for (int i = 0; i < upArray.length; i++) {
  128 + if (upArray[i] != null) {
  129 + upArray[i].setFcpSn(i + 1);
  130 + list.add(upArray[i]);
  131 + }
  132 + }
  133 + for (int i = 0; i < downArray.length; i++) {
  134 + if (downArray[i] != null) {
  135 + downArray[i].setFcpSn(i + 1);
  136 + list.add(downArray[i]);
  137 + }
  138 + }
  139 + return list;
  140 + }
  141 +
  142 + /**
  143 + * 接下来要执行的3个班次
  144 + *
  145 + * @param list
  146 + * @return
  147 + */
  148 + private ScheduleRealInfo[] nexts(List<ScheduleRealInfo> list) {
  149 + ScheduleRealInfo[] array = new ScheduleRealInfo[3];
  150 + Collections.sort(list, schFCSJComparator);
  151 +
  152 + int count = 0, threshold = 1000 * 60 * 30;
  153 + long t = System.currentTimeMillis();
  154 + for (ScheduleRealInfo sch : list) {
  155 + if (count == 3)
  156 + break;
  157 +
  158 + //烂班
  159 + if (sch.isDestroy())
  160 + continue;
  161 +
  162 + //进场、出场、2点间空驶
  163 + if (sch.getBcType().equals("in")
  164 + || sch.getBcType().equals("out")
  165 + || sch.getBcType().equals("ldks"))
  166 + continue;
  167 +
  168 + //有实发实达时间的
  169 + if (StringUtils.isNotEmpty(sch.getFcsjActual())
  170 + || StringUtils.isNotEmpty(sch.getZdsjActual()))
  171 + continue;
  172 +
  173 + if (t - sch.getDfsjT() > threshold)
  174 + continue;
  175 +
  176 + array[count] = sch;
  177 + count++;
  178 + }
  179 + return array;
  180 + }
  181 +
  182 + @Autowired
  183 + UpdateInfoThread updateInfoThread;
  184 +
  185 + @Override
  186 + public void run(String... strings) throws Exception {
  187 + bcTypeMap = new HashMap<>();
  188 + bcTypeMap.put("normal", "正常班次");
  189 + bcTypeMap.put("region", "区间");
  190 + bcTypeMap.put("venting", "直放");
  191 + bcTypeMap.put("major", "放站");
  192 + bcTypeMap.put("ldks", "两点间空驶");
  193 + //Application.mainServices.scheduleWithFixedDelay(updateInfoThread, 60, 40, TimeUnit.SECONDS);
  194 + }
  195 +
  196 + @Component
  197 + private static class UpdateInfoThread extends Thread {
  198 +
  199 + @Autowired
  200 + CarOutInfo carOutInfoHandler;
  201 +
  202 + @Override
  203 + public void run() {
  204 + carOutInfoHandler.updateAll();
  205 + }
  206 + }
  207 +}
src/main/java/com/bsth/data/arrival/ArrivalComparator.java renamed to src/main/java/com/bsth/data/forecast/ArrivalComparator.java
1 -package com.bsth.data.arrival; 1 +package com.bsth.data.forecast;
  2 +
  3 +import com.bsth.data.forecast.entity.ArrivalEntity;
2 4
3 import java.util.Comparator; 5 import java.util.Comparator;
4 6
src/main/java/com/bsth/data/arrival/DataLoader.java renamed to src/main/java/com/bsth/data/forecast/ArrivalDataLoader.java
1 -package com.bsth.data.arrival; 1 +package com.bsth.data.forecast;
  2 +
  3 +import com.bsth.data.BasicData;
  4 +import com.bsth.data.LineConfigData;
  5 +import com.bsth.data.forecast.entity.ArrivalEntity;
  6 +import com.bsth.entity.realcontrol.LineConfig;
  7 +import com.bsth.util.db.DBUtils_MS;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.stereotype.Component;
2 12
3 import java.sql.Connection; 13 import java.sql.Connection;
4 import java.sql.PreparedStatement; 14 import java.sql.PreparedStatement;
@@ -9,16 +19,6 @@ import java.util.Calendar; @@ -9,16 +19,6 @@ import java.util.Calendar;
9 import java.util.Collection; 19 import java.util.Collection;
10 import java.util.List; 20 import java.util.List;
11 21
12 -import org.slf4j.Logger;  
13 -import org.slf4j.LoggerFactory;  
14 -import org.springframework.beans.factory.annotation.Autowired;  
15 -import org.springframework.stereotype.Component;  
16 -  
17 -import com.bsth.data.BasicData;  
18 -import com.bsth.data.LineConfigData;  
19 -import com.bsth.entity.realcontrol.LineConfig;  
20 -import com.bsth.util.db.DBUtils_MS;  
21 -  
22 /** 22 /**
23 * 23 *
24 * @ClassName: DataLoader 24 * @ClassName: DataLoader
@@ -28,7 +28,7 @@ import com.bsth.util.db.DBUtils_MS; @@ -28,7 +28,7 @@ import com.bsth.util.db.DBUtils_MS;
28 * 28 *
29 */ 29 */
30 @Component 30 @Component
31 -public class DataLoader { 31 +public class ArrivalDataLoader {
32 32
33 private static Long prveLoadTime; 33 private static Long prveLoadTime;
34 34
src/main/java/com/bsth/data/arrival/ArrivalEntity.java renamed to src/main/java/com/bsth/data/forecast/entity/ArrivalEntity.java
1 -package com.bsth.data.arrival; 1 +package com.bsth.data.forecast.entity;
  2 +
  3 +import com.bsth.data.BasicData;
2 4
3 import java.text.SimpleDateFormat; 5 import java.text.SimpleDateFormat;
4 import java.util.Date; 6 import java.util.Date;
5 7
6 -import com.bsth.data.BasicData;  
7 -  
8 /** 8 /**
9 * 9 *
10 * @ClassName: ArrivalEntity 10 * @ClassName: ArrivalEntity
src/main/java/com/bsth/data/gpsdata/GpsRealData.java
1 package com.bsth.data.gpsdata; 1 package com.bsth.data.gpsdata;
2 2
  3 +import com.bsth.Application;
3 import com.bsth.data.BasicData; 4 import com.bsth.data.BasicData;
4 import com.bsth.data.forecast.ForecastRealServer; 5 import com.bsth.data.forecast.ForecastRealServer;
5 import com.bsth.data.gpsdata.client.ClientApp; 6 import com.bsth.data.gpsdata.client.ClientApp;
@@ -16,6 +17,7 @@ import org.springframework.boot.CommandLineRunner; @@ -16,6 +17,7 @@ import org.springframework.boot.CommandLineRunner;
16 import org.springframework.stereotype.Component; 17 import org.springframework.stereotype.Component;
17 18
18 import java.util.*; 19 import java.util.*;
  20 +import java.util.concurrent.TimeUnit;
19 21
20 /** 22 /**
21 * @author PanZhao 23 * @author PanZhao
@@ -61,7 +63,7 @@ public class GpsRealData implements CommandLineRunner { @@ -61,7 +63,7 @@ public class GpsRealData implements CommandLineRunner {
61 //定时从网关http形式获取GPS数据 --- 已弃用,现socket客户端接入数据 63 //定时从网关http形式获取GPS数据 --- 已弃用,现socket客户端接入数据
62 //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS); 64 //Application.mainServices.scheduleWithFixedDelay(gpsDataLoader, 20, 3, TimeUnit.SECONDS);
63 //定时扫描掉离线 65 //定时扫描掉离线
64 - //Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS); 66 + Application.mainServices.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);
65 67
66 //gps 客户端 68 //gps 客户端
67 //clientApp.init(); 69 //clientApp.init();
src/main/java/com/bsth/data/gpsdata/client/ClientApp.java
@@ -15,12 +15,12 @@ import org.apache.mina.filter.codec.ProtocolCodecFilter; @@ -15,12 +15,12 @@ import org.apache.mina.filter.codec.ProtocolCodecFilter;
15 import org.apache.mina.filter.logging.LogLevel; 15 import org.apache.mina.filter.logging.LogLevel;
16 import org.apache.mina.filter.logging.LoggingFilter; 16 import org.apache.mina.filter.logging.LoggingFilter;
17 import org.apache.mina.transport.socket.nio.NioSocketConnector; 17 import org.apache.mina.transport.socket.nio.NioSocketConnector;
  18 +import org.slf4j.Logger;
  19 +import org.slf4j.LoggerFactory;
18 import org.springframework.beans.factory.annotation.Autowired; 20 import org.springframework.beans.factory.annotation.Autowired;
19 import org.springframework.stereotype.Component; 21 import org.springframework.stereotype.Component;
20 22
21 import java.net.InetSocketAddress; 23 import java.net.InetSocketAddress;
22 -import java.util.concurrent.ExecutorService;  
23 -import java.util.concurrent.Executors;  
24 24
25 /** 25 /**
26 * Created by panzhao on 2017/5/4. 26 * Created by panzhao on 2017/5/4.
@@ -30,7 +30,6 @@ public class ClientApp { @@ -30,7 +30,6 @@ public class ClientApp {
30 30
31 private static NioSocketConnector pdDataConnector; 31 private static NioSocketConnector pdDataConnector;
32 private static NioSocketConnector pfDataConnector; 32 private static NioSocketConnector pfDataConnector;
33 - private static ExecutorService exec;  
34 33
35 @Autowired 34 @Autowired
36 private PdClientHandler pdClient; 35 private PdClientHandler pdClient;
@@ -39,6 +38,8 @@ public class ClientApp { @@ -39,6 +38,8 @@ public class ClientApp {
39 @Autowired 38 @Autowired
40 GpsBeforeBuffer gpsBeforeBuffer; 39 GpsBeforeBuffer gpsBeforeBuffer;
41 40
  41 + static Logger logger = LoggerFactory.getLogger(ClientApp.class);
  42 +
42 public static boolean dconnect(String device) { 43 public static boolean dconnect(String device) {
43 boolean flag = false; 44 boolean flag = false;
44 try { 45 try {
@@ -59,6 +60,8 @@ public class ClientApp { @@ -59,6 +60,8 @@ public class ClientApp {
59 WriteFuture write = session.write(bytes); 60 WriteFuture write = session.write(bytes);
60 write.awaitUninterruptibly(); 61 write.awaitUninterruptibly();
61 flag = true; 62 flag = true;
  63 +
  64 + logger.info("dconnect...");
62 //SessionManager.getInstance().register(device, session); 65 //SessionManager.getInstance().register(device, session);
63 } catch (Exception e) { 66 } catch (Exception e) {
64 e.printStackTrace(); 67 e.printStackTrace();
@@ -74,6 +77,8 @@ public class ClientApp { @@ -74,6 +77,8 @@ public class ClientApp {
74 IoSession session = con.getSession(); 77 IoSession session = con.getSession();
75 session.setAttribute("deviceId", device); 78 session.setAttribute("deviceId", device);
76 flag = true; 79 flag = true;
  80 +
  81 + logger.info("fconnect...");
77 } catch (Exception e) { 82 } catch (Exception e) {
78 e.printStackTrace(); 83 e.printStackTrace();
79 } 84 }
@@ -81,7 +86,7 @@ public class ClientApp { @@ -81,7 +86,7 @@ public class ClientApp {
81 } 86 }
82 87
83 public void init() { 88 public void init() {
84 - exec = Executors.newFixedThreadPool(4); 89 + //exec = Executors.newFixedThreadPool(4);
85 //sexec.scheduleAtFixedRate(new SessionChecker(), 1, 1, TimeUnit.MINUTES); 90 //sexec.scheduleAtFixedRate(new SessionChecker(), 1, 1, TimeUnit.MINUTES);
86 /*******************************浦东********************************/ 91 /*******************************浦东********************************/
87 pdDataConnector = new NioSocketConnector(); 92 pdDataConnector = new NioSocketConnector();
@@ -128,4 +133,4 @@ public class ClientApp { @@ -128,4 +133,4 @@ public class ClientApp {
128 133
129 gpsBeforeBuffer.init(); 134 gpsBeforeBuffer.init();
130 } 135 }
131 -} 136 +}
132 \ No newline at end of file 137 \ No newline at end of file
src/main/java/com/bsth/data/gpsdata/client/GpsBeforeBuffer.java
@@ -63,7 +63,7 @@ public class GpsBeforeBuffer { @@ -63,7 +63,7 @@ public class GpsBeforeBuffer {
63 } 63 }
64 64
65 public void init(){ 65 public void init(){
66 - Application.mainServices.scheduleWithFixedDelay(gpsHandleThread, 20, 2, TimeUnit.SECONDS); 66 + Application.mainServices.scheduleWithFixedDelay(gpsHandleThread, 20 * 1000, 1100, TimeUnit.MILLISECONDS);
67 } 67 }
68 68
69 @Component 69 @Component
@@ -100,4 +100,4 @@ public class GpsBeforeBuffer { @@ -100,4 +100,4 @@ public class GpsBeforeBuffer {
100 return -1; 100 return -1;
101 return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); 101 return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0);
102 } 102 }
103 -} 103 +}
104 \ No newline at end of file 104 \ No newline at end of file
src/main/java/com/bsth/data/match/Arrival2Schedule.java deleted 100644 → 0
1 -package com.bsth.data.match;  
2 -  
3 -import java.util.ArrayList;  
4 -import java.util.Collections;  
5 -import java.util.List;  
6 -import java.util.Set;  
7 -  
8 -import org.joda.time.format.DateTimeFormat;  
9 -import org.joda.time.format.DateTimeFormatter;  
10 -import org.slf4j.Logger;  
11 -import org.slf4j.LoggerFactory;  
12 -import org.springframework.beans.BeansException;  
13 -import org.springframework.context.ApplicationContext;  
14 -import org.springframework.context.ApplicationContextAware;  
15 -import org.springframework.stereotype.Component;  
16 -  
17 -import com.bsth.data.LineConfigData;  
18 -import com.bsth.data.arrival.ArrivalComparator;  
19 -import com.bsth.data.arrival.ArrivalData_GPS;  
20 -import com.bsth.data.arrival.ArrivalEntity;  
21 -import com.bsth.data.schedule.DayOfSchedule;  
22 -import com.bsth.data.schedule.ScheduleComparator;  
23 -import com.bsth.entity.realcontrol.LineConfig;  
24 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
25 -import com.bsth.service.directive.DirectiveService;  
26 -import com.bsth.websocket.handler.SendUtils;  
27 -import com.google.common.collect.ArrayListMultimap;  
28 -  
29 -/**  
30 - *  
31 - * @ClassName: Arrival2Schedule  
32 - * @Description: TODO(到离站数据 和 计划班次进行匹配 注意线程安全!!!!)  
33 - * @author PanZhao  
34 - * @date 2016年8月28日 上午1:13:02  
35 - *  
36 - */  
37 -@Component  
38 -public class Arrival2Schedule implements ApplicationContextAware {  
39 -  
40 - private static DayOfSchedule dayOfSchedule;  
41 - private static SendUtils sendUtils;  
42 - private static DirectiveService directiveService;  
43 - private static LineConfigData lineConfigData;  
44 - private final static int ONE_MINUTE = 1000 * 60;  
45 - //定一个4小时的范围,基本能对正常班次进行容错。主要防止早上停车场GPS飘导致完成晚上的进场班次  
46 - private final static int FOUR_HOURS = 1000 * 60 * 60 * 4;  
47 -  
48 - private static Logger logger = LoggerFactory.getLogger(Arrival2Schedule.class);  
49 -  
50 - private static ArrayListMultimap<String, ExpectArrivalEnd> expectMap = ArrayListMultimap.create();  
51 -  
52 - /**  
53 - *  
54 - * @Title: start  
55 - * @Description: TODO(开始)  
56 - * @param @param cars 需要匹配的车辆集合  
57 - */  
58 - public static void start(Set<String> cars){  
59 -  
60 - for(String car : cars){  
61 - new SchMatchThread(car).start();  
62 - }  
63 - }  
64 -  
65 - public static class SchMatchThread extends Thread{  
66 - String nbbm;  
67 - LineConfig conf;  
68 -  
69 - public SchMatchThread(String nbbm){  
70 - this.nbbm = nbbm;  
71 - }  
72 -  
73 - //排序器  
74 - private ScheduleComparator.FCSJ schComparator = new ScheduleComparator.FCSJ();  
75 - private ArrivalComparator arrComparator = new ArrivalComparator();  
76 - private MatchResultComparator mrComparator = new MatchResultComparator();  
77 -  
78 - private static DateTimeFormatter fmtyyyyMMddHHmm = DateTimeFormat.forPattern("yyyy-MM-ddHH:mm");  
79 -  
80 - @Override  
81 - public void run() {  
82 - //班次列表  
83 - List<ScheduleRealInfo> schList = dayOfSchedule.findByNbbm(nbbm);  
84 - //进出起终点数据  
85 - List<ArrivalEntity> arrList = ArrivalData_GPS.findByNbbm(nbbm);  
86 -  
87 - if(schList.size() == 0 || arrList.size() == 0)  
88 - return;  
89 -  
90 - conf = lineConfigData.get(schList.get(0).getXlBm());  
91 - //排序  
92 - Collections.sort(schList, schComparator);  
93 - Collections.sort(arrList, arrComparator);  
94 - //过滤班次  
95 - schList = matchFilter(schList);  
96 -  
97 - //检查并修正首班出场终点信号,可能会出现走向异常  
98 - correctFirstSignal(schList, arrList);  
99 -  
100 -  
101 - //用实际来匹配计划  
102 - for(ArrivalEntity arr : arrList){  
103 - match(arr, schList);  
104 - }  
105 - }  
106 -  
107 - private void match(ArrivalEntity arr, List<ScheduleRealInfo> schList) {  
108 -  
109 - if(arr.getInOut() == 1)  
110 - matchOut(arr, schList);  
111 - else if(arr.getInOut() == 0)  
112 - matchIn(arr, schList);  
113 - }  
114 -  
115 - private List<ScheduleRealInfo> matchFilter(List<ScheduleRealInfo> schList) {  
116 - List<ScheduleRealInfo> list = new ArrayList<>();  
117 - for(ScheduleRealInfo sch : schList){  
118 - //烂班不匹配  
119 - if(sch.isDestroy())  
120 - continue;  
121 -  
122 - //线路配置出站既出场,并且没有里程的不匹配  
123 - if(conf.getOutConfig()==2 && sch.getBcsj() == null && sch.getJhlc() == null)  
124 - continue;  
125 -  
126 - list.add(sch);  
127 - }  
128 - return list;  
129 - }  
130 -  
131 - private void matchOut(ArrivalEntity arr, List<ScheduleRealInfo> schList){  
132 - if(arr.getFlag() == -1)  
133 - return;  
134 -  
135 - List<MatchResult> mrs = new ArrayList<>();  
136 - ScheduleRealInfo sch;  
137 - MatchResult mr;  
138 - for(int i = 0; i < schList.size(); i ++){  
139 - sch = schList.get(i);  
140 - if(!arr.isTcc() && arr.getUpDown() != Integer.parseInt(sch.getXlDir()))  
141 - continue;  
142 -  
143 - if(!arr.getStopNo().equals(sch.getQdzCode()))  
144 - continue;  
145 -  
146 - //班次有实发时间  
147 - if(sch.getFcsjActualTime() != null){  
148 - //实际发车已经被引用  
149 - if(Math.abs(arr.getTs() - sch.getFcsjActualTime()) < ONE_MINUTE)  
150 - return;  
151 - else  
152 - continue;  
153 - }  
154 - //添加一个匹配结果  
155 - mr = new MatchResult();  
156 - mr.sch = sch;  
157 - mr.ts = arr.getTs();  
158 - mr.diff = arr.getTs() - sch.getFcsjT();  
159 - mr.success = dayOfSchedule.validStartTime(sch, arr.getTs());  
160 -  
161 - if(Math.abs(mr.diff) < FOUR_HOURS && mr.success)  
162 - mrs.add(mr);  
163 - }  
164 -  
165 - if(mrs.size() > 0){  
166 - //排序后的第一个 就是最合适的匹配  
167 - Collections.sort(mrs, mrComparator);  
168 - mr = mrs.get(0);  
169 -  
170 - //漂移判定  
171 - if(driftCheck(mr, arr)){  
172 - carOut(mr);  
173 - }  
174 - }  
175 - }  
176 -  
177 - private void matchIn(ArrivalEntity inArr, List<ScheduleRealInfo> schList){  
178 -  
179 - List<MatchResult> mrs = new ArrayList<>();  
180 - ScheduleRealInfo sch;  
181 - MatchResult mr;  
182 - for(int i = 0; i < schList.size(); i ++){  
183 - sch = schList.get(i);  
184 - if(!inArr.isTcc() && inArr.getUpDown() != Integer.parseInt(sch.getXlDir()))  
185 - continue;  
186 -  
187 - if(!inArr.getStopNo().equals(sch.getZdzCode()))  
188 - continue;  
189 -  
190 - //班次有实达时间  
191 - if(sch.getZdsjActualTime() != null){  
192 - //实际到达已经被引用  
193 - if(Math.abs(inArr.getTs() - sch.getZdsjActualTime()) < ONE_MINUTE)  
194 - return;  
195 - else  
196 - continue;  
197 - }  
198 -  
199 - //添加一个匹配结果  
200 - mr = new MatchResult();  
201 - mr.sch = sch;  
202 - mr.ts = inArr.getTs();  
203 - //班次没有里程和运送时间的  
204 - if(sch.getZdsj() == null){  
205 - if(i < schList.size()-1)  
206 - mr.diff = inArr.getTs() - schList.get(i + 1).getDfsjT();  
207 - else  
208 - mr.diff = inArr.getTs() - sch.getDfsjT();  
209 - }  
210 - else  
211 - mr.diff = inArr.getTs() - sch.getZdsjT();  
212 - mr.success = dayOfSchedule.validEndTime(sch, inArr.getTs());  
213 - if(Math.abs(mr.diff) < FOUR_HOURS && mr.success)  
214 - mrs.add(mr);  
215 - }  
216 -  
217 - if(mrs.size() > 0){  
218 - //排序后的第一个 就是最合适的匹配  
219 - Collections.sort(mrs, mrComparator);  
220 - mr = mrs.get(0);  
221 - carInStop(mr);  
222 - }  
223 - }  
224 -  
225 - /**  
226 - *  
227 - * @Title: carOut  
228 - * @Description: TODO(车辆发出)  
229 - */  
230 - public void carOut(MatchResult mr){  
231 - ScheduleRealInfo sch = mr.sch;  
232 -  
233 - if(!isExpectOut(mr))  
234 - return;  
235 - //设置发车时间  
236 - sch.setFcsjActualAll(mr.ts);  
237 - //通知客户端  
238 - sendUtils.sendFcsj(sch);  
239 - //持久化  
240 - dayOfSchedule.save(sch);  
241 - //车辆当前执行班次  
242 - dayOfSchedule.addExecPlan(sch);  
243 -  
244 - //期望车辆到达的终点  
245 - if(sch.getZdsj() != null)  
246 - expectMap.put(nbbm, ExpectArrivalEnd.getEndInstance(sch, mr.ts));  
247 - }  
248 -  
249 - /**  
250 - *  
251 - * @Title: isExpectOut  
252 - * @Description: TODO(是否是一个期望的出站匹配结果)  
253 - */  
254 - private boolean isExpectOut(MatchResult mr){  
255 - ScheduleRealInfo sch = mr.sch;  
256 - String nbbm = sch.getClZbh();  
257 - if(expectMap.containsKey(nbbm)){  
258 - List<ExpectArrivalEnd> eads = expectMap.get(nbbm);  
259 - for(ExpectArrivalEnd ead : eads){  
260 - if(sch.getQdzCode().equals(ead.getEndStation())  
261 - || mr.ts > ead.getEndTime()){  
262 - expectMap.removeAll(nbbm);  
263 - return true;  
264 - }  
265 - }  
266 - return false;  
267 - }  
268 - return true;  
269 - }  
270 -  
271 - /**  
272 - *  
273 - * @Title: carInStop  
274 - * @Description: TODO(车辆进入终点站)  
275 - */  
276 - public void carInStop(MatchResult mr){  
277 - ScheduleRealInfo sch = mr.sch;  
278 - String nbbm=sch.getClZbh();  
279 - if(!isExpectIn(mr))  
280 - return;  
281 -  
282 - //如果是进停车场,并且实达时间差值大于 30 分钟,并且之前还有未完成班次。  
283 - if(sch.getBcType().equals("in") && Math.abs(mr.diff) > (1000 * 60 * 30)){  
284 - int prve_nen = dayOfSchedule.prveNotExecNum(sch);  
285 - if(prve_nen > 0)  
286 - return;  
287 - }  
288 -  
289 - sch.setZdsjActualAll(mr.ts);  
290 - int doneSum = dayOfSchedule.doneSum(nbbm);  
291 - ScheduleRealInfo next = dayOfSchedule.next(sch);  
292 - if(null != next){  
293 - next.setQdzArrDateSJ(sch.getZdsjActual());  
294 - //下发调度指令  
295 - directiveService.send60Dispatch(next, doneSum, "到站@系统");  
296 -  
297 - //完成“起点既停车场”的进场班次  
298 - if(next.getBcType().equals("in") && next.getJhlc() == null)  
299 - next.setFcsjActualAll(mr.ts);  
300 -  
301 - //套跑 -下发线路切换指令  
302 - if(!next.getXlBm().equals(sch.getXlBm()))  
303 - directiveService.lineChange(nbbm, next.getXlBm(), "套跑@系统");  
304 - }  
305 - else//下发文本指令(已结束运营)  
306 - directiveService.send60Phrase(nbbm, "到达终点 " + sch.getZdzName() + ",已完成当日所有排班。", "系统");  
307 - //通知客户端  
308 - sendUtils.sendZdsj(sch, next, doneSum);  
309 - //持久化  
310 - dayOfSchedule.save(sch);  
311 - logger.info(sch.getClZbh() + "移除正在执行班次," + sch.getFcsj());  
312 - //移除车辆正在执行班次索引  
313 - dayOfSchedule.removeExecPlan(nbbm);  
314 - }  
315 -  
316 - /**  
317 - *  
318 - * @Title: isExpectOut  
319 - * @Description: TODO(是否是一个期望的进站匹配结果)  
320 - */  
321 - private boolean isExpectIn(MatchResult mr){  
322 - ScheduleRealInfo sch = mr.sch;  
323 - String nbbm = sch.getClZbh();  
324 - if(expectMap.containsKey(nbbm)){  
325 - List<ExpectArrivalEnd> eads = expectMap.get(nbbm);  
326 - for(ExpectArrivalEnd ead : eads){  
327 - if(sch.getZdzCode().equals(ead.getEndStation())  
328 - || mr.ts > ead.getEndTime()){  
329 - expectMap.removeAll(nbbm);  
330 - return true;  
331 - }  
332 - }  
333 - return false;  
334 - }  
335 - return true;  
336 - }  
337 -  
338 - /**  
339 - *  
340 - * @Title: correctFirstSignal  
341 - * @Description: TODO(检查并纠正首班出场到离站)  
342 - */  
343 - private final static long TEN_MINUTES = 1000 * 60 * 10;  
344 - private void correctFirstSignal(List<ScheduleRealInfo> schList, List<ArrivalEntity> arrList) {  
345 - ScheduleRealInfo sch = schList.get(0);  
346 - ArrivalEntity arr = arrList.get(0);  
347 -  
348 - //有里程的出场班次才需要纠正  
349 - if(arr.isCorrect() || !sch.getBcType().equals("out") || sch.getJhlc() == null || sch.getBcsj() == null)  
350 - return;  
351 -  
352 - //如果首个进出站信号是出场  
353 - if(arr.isOutTcc() && arrList.size() >= 2)  
354 - arr = arrList.get(1);  
355 - else  
356 - return;  
357 -  
358 - //出场任务 “进终点” 信号才需要纠正  
359 - if(arr.getInOut() != 0)  
360 - return;  
361 -  
362 - //在计划终点之前到达,或者之后10分钟内到达  
363 - if(arr.getTs() < sch.getZdsjT()  
364 - || arr.getTs() - sch.getZdsjT() < TEN_MINUTES){  
365 -  
366 - int upDown = Integer.parseInt(sch.getXlDir());  
367 - //走向不一致,相信班次的走向。纠正进站信号  
368 - if(arr.getUpDown() != upDown  
369 - && arr.getStopName().equals(sch.getZdzName())){  
370 -  
371 -  
372 - String old = arr.toString();  
373 - arr.setUpDown(upDown);  
374 - arr.setStopNo(sch.getZdzCode());  
375 - arr.setCorrect(true);  
376 - arr.setCorrectText(old + " | " + arr.toString());  
377 -  
378 - logger.info("被纠正的信号:" + arr.getCorrectText());  
379 - }  
380 - }  
381 - }  
382 -  
383 - /**  
384 - *  
385 - * @Title: driftCheck  
386 - * @Description: TODO(漂移判定)  
387 - */  
388 - public boolean driftCheck(MatchResult mr, ArrivalEntity arr){  
389 - try{  
390 - //上行发车,和到达时间比较一下。起点一般不会立即发出  
391 - if(mr.sch.getXlDir().equals("0")  
392 - && null != mr.sch.getQdzArrDateSJ()){  
393 -  
394 -  
395 - long dt = fmtyyyyMMddHHmm.parseMillis(mr.sch.getRealExecDate() + mr.sch.getQdzArrDateSJ());  
396 -  
397 - //停站时间少于 计划的3分之1,标记为漂移信号  
398 - if((mr.ts - dt < (mr.sch.getDfsjT() - dt) / 3)){  
399 - arr.setCorrect(true);  
400 - arr.setCorrectText("停站时间太短,标记为信号漂移");  
401 - arr.setFlag(-1);  
402 -  
403 - logger.info("漂移判定:" + arr);  
404 - return false;  
405 - }  
406 - }  
407 - }catch(Exception e){  
408 - logger.error("", e);  
409 - }  
410 - return true;  
411 - }  
412 - }  
413 -  
414 - @Override  
415 - public void setApplicationContext(ApplicationContext arg0) throws BeansException {  
416 - sendUtils = arg0.getBean(SendUtils.class);  
417 - dayOfSchedule = arg0.getBean(DayOfSchedule.class);  
418 - directiveService = arg0.getBean(DirectiveService.class);  
419 - lineConfigData = arg0.getBean(LineConfigData.class);  
420 - }  
421 -  
422 - /**  
423 - *  
424 - * @Title: removeExpect  
425 - * @Description: TODO(清除预期站点)  
426 - * @param @param nbbm  
427 - */  
428 - public void removeExpect(String nbbm){  
429 - expectMap.removeAll(nbbm);  
430 - }  
431 -  
432 - public static void addExpect(String nbbm, ExpectArrivalEnd eae){  
433 - expectMap.put(nbbm, eae);  
434 - }  
435 -}  
src/main/java/com/bsth/data/match/ExpectArrivalEnd.java deleted 100644 → 0
1 -package com.bsth.data.match;  
2 -  
3 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
4 -  
5 -/**  
6 - *  
7 - * @ClassName: ExpectArrivalEnd  
8 - * @Description: TODO(期望车辆在某个时间段到达某个终点或 发出某个起点........)  
9 - * @author PanZhao  
10 - * @date 2016年11月2日 下午8:04:43  
11 - *  
12 - */  
13 -public class ExpectArrivalEnd {  
14 -  
15 - private String nbbm;  
16 -  
17 - private String endStation;  
18 -  
19 - private Long endTime;  
20 -  
21 - public static ExpectArrivalEnd getEndInstance(ScheduleRealInfo sch, long t){  
22 - ExpectArrivalEnd ead = new ExpectArrivalEnd();  
23 - ead.setNbbm(sch.getClZbh());  
24 - ead.setEndStation(sch.getZdzCode());  
25 - if(sch.getBcType().equals("out"))  
26 - ead.setEndTime(sch.getZdsjT());  
27 - else{  
28 - ead.setEndTime(sch.getZdsjT() - (sch.getDfsjT() - t));  
29 - }  
30 - return ead;  
31 - }  
32 -  
33 -  
34 - public String getNbbm() {  
35 - return nbbm;  
36 - }  
37 -  
38 - public void setNbbm(String nbbm) {  
39 - this.nbbm = nbbm;  
40 - }  
41 -  
42 - public String getEndStation() {  
43 - return endStation;  
44 - }  
45 -  
46 - public void setEndStation(String endStation) {  
47 - this.endStation = endStation;  
48 - }  
49 -  
50 - public Long getEndTime() {  
51 - return endTime;  
52 - }  
53 -  
54 - public void setEndTime(Long endTime) {  
55 - this.endTime = endTime;  
56 - }  
57 -}  
src/main/java/com/bsth/data/match/MatchResult.java deleted 100644 → 0
1 -package com.bsth.data.match;  
2 -  
3 -import com.bsth.entity.realcontrol.ScheduleRealInfo;  
4 -  
5 -/**  
6 - *  
7 - * @ClassName: MatchResult  
8 - * @Description: TODO(实际和计划匹配结果)  
9 - * @author PanZhao  
10 - * @date 2016年8月10日 下午3:55:48  
11 - *  
12 - */  
13 -public class MatchResult {  
14 -  
15 - /** 班次 */  
16 - public ScheduleRealInfo sch;  
17 -  
18 - /** 时间差 */  
19 - public long diff;  
20 -  
21 - /** 0 进 1 出 */  
22 - public int inOut;  
23 -  
24 - public long ts;  
25 -  
26 - /** 交配成功 */  
27 - public boolean success;  
28 -}  
src/main/java/com/bsth/data/match/MatchResultComparator.java deleted 100644 → 0
1 -package com.bsth.data.match;  
2 -  
3 -import java.util.Comparator;  
4 -  
5 -public class MatchResultComparator implements Comparator<MatchResult>{  
6 -  
7 - @Override  
8 - public int compare(MatchResult o1, MatchResult o2) {  
9 - return (int) (Math.abs(o1.diff) - Math.abs(o2.diff));  
10 - }  
11 -}  
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
@@ -1023,4 +1023,8 @@ public class DayOfSchedule implements CommandLineRunner { @@ -1023,4 +1023,8 @@ public class DayOfSchedule implements CommandLineRunner {
1023 Collections.sort(list, schFCSJComparator); 1023 Collections.sort(list, schFCSJComparator);
1024 return next(list, sch); 1024 return next(list, sch);
1025 } 1025 }
  1026 +
  1027 + public ArrayListMultimap<String, ScheduleRealInfo> getLpScheduleMap(){
  1028 + return lpScheduleMap;
  1029 + }
1026 } 1030 }
1027 \ No newline at end of file 1031 \ No newline at end of file
src/main/java/com/bsth/entity/forecast/Sample.java
1 package com.bsth.entity.forecast; 1 package com.bsth.entity.forecast;
2 2
3 3
4 -import java.text.SimpleDateFormat;  
5 -import java.util.Date;  
6 -  
7 -import javax.persistence.Entity;  
8 -import javax.persistence.GeneratedValue;  
9 -import javax.persistence.Id;  
10 -import javax.persistence.Table;  
11 -import javax.persistence.Transient;  
12 - 4 +import com.bsth.data.forecast.entity.ArrivalEntity;
13 import org.slf4j.Logger; 5 import org.slf4j.Logger;
14 import org.slf4j.LoggerFactory; 6 import org.slf4j.LoggerFactory;
15 7
16 -import com.bsth.data.arrival.ArrivalEntity; 8 +import javax.persistence.*;
17 9
18 /** 10 /**
19 * 11 *
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
@@ -200,6 +200,10 @@ public class ScheduleRealInfo { @@ -200,6 +200,10 @@ public class ScheduleRealInfo {
200 /** 是否有补发GPS信号 */ 200 /** 是否有补发GPS信号 */
201 private boolean reissue; 201 private boolean reissue;
202 202
  203 + /** 发车屏 发车顺序号,不持久化,会动态变化 */
  204 + @Transient
  205 + private int fcpSn;
  206 +
203 public boolean isDfAuto() { 207 public boolean isDfAuto() {
204 return dfAuto; 208 return dfAuto;
205 } 209 }
@@ -912,4 +916,12 @@ public class ScheduleRealInfo { @@ -912,4 +916,12 @@ public class ScheduleRealInfo {
912 public void setLate2(boolean late2) { 916 public void setLate2(boolean late2) {
913 this.late2 = late2; 917 this.late2 = late2;
914 } 918 }
  919 +
  920 + public int getFcpSn() {
  921 + return fcpSn;
  922 + }
  923 +
  924 + public void setFcpSn(int fcpSn) {
  925 + this.fcpSn = fcpSn;
  926 + }
915 } 927 }
src/main/java/com/bsth/service/forecast/SampleServiceImpl.java
1 package com.bsth.service.forecast; 1 package com.bsth.service.forecast;
2 2
3 -import java.text.SimpleDateFormat;  
4 -import java.util.ArrayList;  
5 -import java.util.Collections;  
6 -import java.util.Comparator;  
7 -import java.util.HashMap;  
8 -import java.util.Iterator;  
9 -import java.util.List;  
10 -import java.util.Map;  
11 -  
12 -import javax.transaction.Transactional;  
13 -  
14 -import org.slf4j.Logger;  
15 -import org.slf4j.LoggerFactory;  
16 -import org.springframework.beans.factory.annotation.Autowired;  
17 -import org.springframework.stereotype.Service;  
18 -  
19 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
20 import com.bsth.controller.forecast.dto.CreateSampleParam; 4 import com.bsth.controller.forecast.dto.CreateSampleParam;
21 import com.bsth.data.BasicData; 5 import com.bsth.data.BasicData;
22 -import com.bsth.data.arrival.ArrivalEntity;  
23 -import com.bsth.data.arrival.DataLoader; 6 +import com.bsth.data.forecast.ArrivalDataLoader;
  7 +import com.bsth.data.forecast.entity.ArrivalEntity;
24 import com.bsth.entity.forecast.Sample; 8 import com.bsth.entity.forecast.Sample;
25 import com.bsth.repository.forecast.SampleRepository; 9 import com.bsth.repository.forecast.SampleRepository;
26 import com.bsth.service.forecast.util.CreateByArrivalData; 10 import com.bsth.service.forecast.util.CreateByArrivalData;
27 import com.bsth.service.impl.BaseServiceImpl; 11 import com.bsth.service.impl.BaseServiceImpl;
  12 +import org.slf4j.Logger;
  13 +import org.slf4j.LoggerFactory;
  14 +import org.springframework.beans.factory.annotation.Autowired;
  15 +import org.springframework.stereotype.Service;
  16 +
  17 +import javax.transaction.Transactional;
  18 +import java.text.SimpleDateFormat;
  19 +import java.util.*;
28 20
29 @Service 21 @Service
30 public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements SampleService{ 22 public class SampleServiceImpl extends BaseServiceImpl<Sample, Long> implements SampleService{
@@ -80,7 +72,7 @@ public class SampleServiceImpl extends BaseServiceImpl&lt;Sample, Long&gt; implements @@ -80,7 +72,7 @@ public class SampleServiceImpl extends BaseServiceImpl&lt;Sample, Long&gt; implements
80 sampleRepository.deleteByLineAndUpdown(param.getLineCode(), param.getUpdown()); 72 sampleRepository.deleteByLineAndUpdown(param.getLineCode(), param.getUpdown());
81 73
82 //查询到离站数据 74 //查询到离站数据
83 - DataLoader loader = new DataLoader(); 75 + ArrivalDataLoader loader = new ArrivalDataLoader();
84 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); 76 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
85 77
86 long st = sdf.parse(param.getStartDate()).getTime() 78 long st = sdf.parse(param.getStartDate()).getTime()
src/main/java/com/bsth/service/forecast/util/CreateByArrivalData.java
1 package com.bsth.service.forecast.util; 1 package com.bsth.service.forecast.util;
2 2
3 -import java.text.DecimalFormat;  
4 -import java.text.ParseException;  
5 -import java.text.SimpleDateFormat;  
6 -import java.util.ArrayList;  
7 -import java.util.Collections;  
8 -import java.util.Comparator;  
9 -import java.util.Date;  
10 -import java.util.HashMap;  
11 -import java.util.List;  
12 -import java.util.Map;  
13 -import java.util.Set;  
14 -  
15 -import org.slf4j.Logger;  
16 -import org.slf4j.LoggerFactory;  
17 -import org.springframework.beans.factory.annotation.Autowired;  
18 -import org.springframework.context.annotation.Scope;  
19 -import org.springframework.stereotype.Component;  
20 -  
21 import com.bsth.controller.forecast.dto.CreateSampleParam; 3 import com.bsth.controller.forecast.dto.CreateSampleParam;
22 import com.bsth.controller.forecast.dto.CreateSampleParam.TimeRange; 4 import com.bsth.controller.forecast.dto.CreateSampleParam.TimeRange;
23 -import com.bsth.data.arrival.ArrivalComparator;  
24 -import com.bsth.data.arrival.ArrivalEntity; 5 +import com.bsth.data.forecast.ArrivalComparator;
  6 +import com.bsth.data.forecast.entity.ArrivalEntity;
25 import com.bsth.entity.StationRoute; 7 import com.bsth.entity.StationRoute;
26 import com.bsth.entity.forecast.Sample; 8 import com.bsth.entity.forecast.Sample;
27 import com.bsth.repository.StationRouteRepository; 9 import com.bsth.repository.StationRouteRepository;
28 import com.google.common.collect.ArrayListMultimap; 10 import com.google.common.collect.ArrayListMultimap;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
  13 +import org.springframework.beans.factory.annotation.Autowired;
  14 +import org.springframework.context.annotation.Scope;
  15 +import org.springframework.stereotype.Component;
  16 +
  17 +import java.text.DecimalFormat;
  18 +import java.text.ParseException;
  19 +import java.text.SimpleDateFormat;
  20 +import java.util.*;
29 21
30 /** 22 /**
31 * 23 *
src/main/java/com/bsth/service/gps/GpsServiceImpl.java
@@ -2,7 +2,7 @@ package com.bsth.service.gps; @@ -2,7 +2,7 @@ package com.bsth.service.gps;
2 2
3 import com.bsth.common.ResponseCode; 3 import com.bsth.common.ResponseCode;
4 import com.bsth.data.BasicData; 4 import com.bsth.data.BasicData;
5 -import com.bsth.data.arrival.ArrivalEntity; 5 +import com.bsth.data.forecast.entity.ArrivalEntity;
6 import com.bsth.data.gpsdata.GpsEntity; 6 import com.bsth.data.gpsdata.GpsEntity;
7 import com.bsth.data.gpsdata.GpsRealData; 7 import com.bsth.data.gpsdata.GpsRealData;
8 import com.bsth.data.gpsdata.arrival.utils.GeoUtils; 8 import com.bsth.data.gpsdata.arrival.utils.GeoUtils;
src/main/java/com/bsth/service/gps/entity/HistoryGps_DTO.java
@@ -2,7 +2,7 @@ package com.bsth.service.gps.entity; @@ -2,7 +2,7 @@ package com.bsth.service.gps.entity;
2 2
3 import com.alibaba.fastjson.JSON; 3 import com.alibaba.fastjson.JSON;
4 import com.alibaba.fastjson.JSONObject; 4 import com.alibaba.fastjson.JSONObject;
5 -import com.bsth.data.arrival.ArrivalEntity; 5 +import com.bsth.data.forecast.entity.ArrivalEntity;
6 import com.fasterxml.jackson.annotation.JsonIgnore; 6 import com.fasterxml.jackson.annotation.JsonIgnore;
7 import com.vividsolutions.jts.geom.Coordinate; 7 import com.vividsolutions.jts.geom.Coordinate;
8 import com.vividsolutions.jts.geom.GeometryFactory; 8 import com.vividsolutions.jts.geom.GeometryFactory;
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
@@ -374,16 +374,16 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im @@ -374,16 +374,16 @@ public class TTInfoDetailServiceImpl extends BServiceImpl&lt;TTInfoDetail, Long&gt; im
374 } 374 }
375 375
376 // 添加一列 空驶班次/空驶里程,fcsj放置数据 376 // 添加一列 空驶班次/空驶里程,fcsj放置数据
377 - fcInfos.add(new FcInfo(null, null, String.format("%d/%.2f", bc_ks, lc_ks), null, null, null, null)); 377 + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_ks, lc_ks), null, null, null, null));
378 378
379 // 添加一列 营运班次/营运里程,fcsj放置数据 379 // 添加一列 营运班次/营运里程,fcsj放置数据
380 - fcInfos.add(new FcInfo(null, null, String.format("%d/%.2f", bc_yy, lc_yy), null, null, null, null)); 380 + fcInfos.add(new FcInfo(null, null, String.format("%d/%.3f", bc_yy, lc_yy), null, null, null, null));
381 381
382 editInfo.getContents().add(fcInfos); 382 editInfo.getContents().add(fcInfos);
383 } 383 }
384 editInfo.getHeader().addAll(Arrays.asList(headarrays)); 384 editInfo.getHeader().addAll(Arrays.asList(headarrays));
385 385
386 - editInfo.setYy_desc(String.format("空驶班次=%d,营运班次=%d,空驶里程=%.2f,营运里程=%.2f,总里程=%.2f", all_bc_ks, all_bc_yy, all_lc_ks, all_lc_yy, all_lc_ks + all_lc_yy)); 386 + editInfo.setYy_desc(String.format("空驶班次=%d,营运班次=%d,空驶里程=%.3f,营运里程=%.3f,总里程=%.3f", all_bc_ks, all_bc_yy, all_lc_ks, all_lc_yy, all_lc_ks + all_lc_yy));
387 } 387 }
388 388
389 LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//"); 389 LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//");
src/main/resources/application-dev.properties
@@ -6,11 +6,11 @@ spring.jpa.hibernate.ddl-auto= update @@ -6,11 +6,11 @@ spring.jpa.hibernate.ddl-auto= update
6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy 6 spring.jpa.hibernate.naming_strategy= org.hibernate.cfg.ImprovedNamingStrategy
7 #DATABASE 7 #DATABASE
8 spring.jpa.database= MYSQL 8 spring.jpa.database= MYSQL
9 -spring.jpa.show-sql= false 9 +spring.jpa.show-sql= true
10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver 10 spring.datasource.driver-class-name= com.mysql.jdbc.Driver
11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false 11 spring.datasource.url= jdbc:mysql://127.0.0.1/control?useUnicode=true&characterEncoding=utf-8&useSSL=false
12 spring.datasource.username= root 12 spring.datasource.username= root
13 -spring.datasource.password= 13 +spring.datasource.password= root
14 #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false 14 #spring.datasource.url= jdbc:mysql://192.168.168.117/pd_control?useUnicode=true&characterEncoding=utf-8&useSSL=false
15 #spring.datasource.username= root 15 #spring.datasource.username= root
16 #spring.datasource.password= root 16 #spring.datasource.password= root
@@ -29,7 +29,7 @@ spring.datasource.validation-query=select 1 @@ -29,7 +29,7 @@ spring.datasource.validation-query=select 1
29 ## 29 ##
30 #222.66.0.204:5555 30 #222.66.0.204:5555
31 ##\u5B9E\u65F6gps 31 ##\u5B9E\u65F6gps
32 -http.gps.real.url= http://180.168.57.114:7474/transport_server/rtgps/ 32 +http.gps.real.url= http://114.80.178.12:18080/transport_server/rtgps/
33 #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/ 33 #http.gps.real.url= http://27.115.69.123:8800/transport_server/rtgps/
34 ##\u6D88\u606F\u4E0B\u53D1 34 ##\u6D88\u606F\u4E0B\u53D1
35 http.send.directive = http://192.168.168.201:9090/transport_server/message/ 35 http.send.directive = http://192.168.168.201:9090/transport_server/message/
36 \ No newline at end of file 36 \ No newline at end of file
src/main/resources/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr
@@ -90,11 +90,11 @@ @@ -90,11 +90,11 @@
90 </info> 90 </info>
91 <notepads> 91 <notepads>
92 <notepad> 92 <notepad>
93 - <note>&#x8fd9;&#x91cc;&#x6709;&#x4e9b;&#x95ee;&#x9898;&#xa;&#x5728;window2012&#x7684;&#x73af;&#x5883;&#x4e0b;&#xff0c;&#xa;MySql&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x4e2d;&#x5982;&#x679c;&#x8fd4;&#x56de;&#x4e2d;&#x6587;&#x5185;&#x5bb9;&#x7684;&#x5b57;&#x6bb5;&#xff0c;&#x8fd9;&#x4e2a;&#x5185;&#x5bb9;&#x4e71;&#x7801;&#xa;&#x89e3;&#x51b3;&#x529e;&#x6cd5;&#xff0c;&#x5c31;&#x662f;&#x6570;&#x636e;&#x5e93;&#x67e5;&#x8be2;&#x5168;&#x90e8;&#x7f13;&#x5b58;&#xff0c;&#x5c31;&#x4e0d;&#x4e71;&#x7801;&#xa;linux&#x73af;&#x5883;&#x4e0b;&#x6ca1;&#x95ee;&#x9898;</note>  
94 - <xloc>165</xloc>  
95 - <yloc>402</yloc>  
96 - <width>333</width>  
97 - <heigth>90</heigth> 93 + <note>TODO&#xff1a;&#x5982;&#x679c;groupby &#x52a0;&#x5165;bctype&#xff0c;&#xa;&#x5219;&#x4ee5;&#x53d1;&#x8f66;&#x987a;&#x5e8f;&#x53f7;&#xff0c;&#x73ed;&#x6b21;&#x7c7b;&#x578b;&#x5206;&#x7ec4;&#x7684;&#x6570;&#x636e;&#x53ef;&#x80fd;&#x91cd;&#x590d;&#xff0c;&#xa;&#x5e94;&#x4e3a;&#x73ed;&#x6b21;&#x7c7b;&#x578b;&#x53ef;&#x80fd;&#x4e0d;&#x4e00;&#x6837;&#xff08;&#x5bfc;&#x5165;&#x4e4b;&#x540e;&#x4eba;&#x4e3a;&#x4fee;&#x6539;&#x7684;&#xff0c;&#x5982;&#x6b63;&#x5e38;&#x73ed;&#x6b21;&#x6539;&#x6210;&#x533a;&#x95f4;&#xff09;&#xff0c;&#xa;&#x56e0;&#x4e3a;&#x5bfc;&#x51fa;&#x65f6;&#x5fc5;&#x987b;&#x6570;&#x636e;&#x4e0d;&#x91cd;&#x590d;&#xff0c;&#x8fd9;&#x91cc;&#x7684;&#x89e3;&#x51b3;&#x65b9;&#x6cd5;&#xff0c;&#x53ea;&#x4f7f;&#x7528;&#x53d1;&#x8f66;&#x987a;&#x5e8f;&#x53f7;&#x5206;&#x7ec4;&#xff0c;&#xa;&#x4ee5;&#x540e;&#x5efa;&#x8bae;&#xff0c;&#x8fd8;&#x662f;&#x539f;&#x6765;&#x7684;&#x65b9;&#x5f0f;&#x5206;&#x7ec4;&#xff0c;&#x7136;&#x540e;&#x628a;&#x66f4;&#x65b0;&#x65f6;&#x95f4;&#x665a;&#x7684;&#x53bb;&#x9664;&#xa;&#xa;&#x4ee5;&#x540e;&#x6539;&#x6210;&#x53bb;&#x9664;&#x91cd;&#x590d;&#x7eaa;&#x5f55;</note>
  94 + <xloc>37</xloc>
  95 + <yloc>309</yloc>
  96 + <width>406</width>
  97 + <heigth>122</heigth>
98 <fontname>YaHei Consolas Hybrid</fontname> 98 <fontname>YaHei Consolas Hybrid</fontname>
99 <fontsize>12</fontsize> 99 <fontsize>12</fontsize>
100 <fontbold>N</fontbold> 100 <fontbold>N</fontbold>
@@ -445,7 +445,7 @@ @@ -445,7 +445,7 @@
445 <schema_name/> 445 <schema_name/>
446 </partitioning> 446 </partitioning>
447 <connection>bus_control_variable</connection> 447 <connection>bus_control_variable</connection>
448 - <sql>select &#xa;fcno&#xa;, min&#x28;xl_dir&#x29; xl_dir&#xa;,min&#x28;qdz&#x29; qdz&#xa;,min&#x28;zdz&#x29; zdz&#xa;,bc_type &#xa;from bsth_c_s_ttinfo_detail&#xa;where ttinfo &#x3d; &#x24;&#x7b;ttinfoid&#x7d;&#xa;group by fcno,bc_type</sql> 448 + <sql>select &#xa;fcno&#xa;, min&#x28;xl&#x29; xl &#xa;, min&#x28;xl_dir&#x29; xl_dir&#xa;, min&#x28;qdz_code&#x29; qdz&#xa;, min&#x28;zdz_code&#x29; zdz&#xa;, min&#x28;bc_type&#x29; bc_type &#xa;from bsth_c_s_ttinfo_detail&#xa;where ttinfo &#x3d; &#x24;&#x7b;ttinfoid&#x7d;&#xa;group by fcno</sql>
449 <limit>0</limit> 449 <limit>0</limit>
450 <lookup/> 450 <lookup/>
451 <execute_each_row>N</execute_each_row> 451 <execute_each_row>N</execute_each_row>
@@ -481,8 +481,8 @@ @@ -481,8 +481,8 @@
481 <fail_on_multiple>N</fail_on_multiple> 481 <fail_on_multiple>N</fail_on_multiple>
482 <eat_row_on_failure>N</eat_row_on_failure> 482 <eat_row_on_failure>N</eat_row_on_failure>
483 <key> 483 <key>
484 - <name>zd</name>  
485 - <field>station</field> 484 + <name>xl</name>
  485 + <field>line</field>
486 <condition>&#x3d;</condition> 486 <condition>&#x3d;</condition>
487 <name2/> 487 <name2/>
488 </key> 488 </key>
@@ -492,6 +492,12 @@ @@ -492,6 +492,12 @@
492 <condition>&#x3d;</condition> 492 <condition>&#x3d;</condition>
493 <name2/> 493 <name2/>
494 </key> 494 </key>
  495 + <key>
  496 + <name>zd</name>
  497 + <field>station_code</field>
  498 + <condition>&#x3d;</condition>
  499 + <name2/>
  500 + </key>
495 <value> 501 <value>
496 <name>station_name</name> 502 <name>station_name</name>
497 <rename>zdname</rename> 503 <rename>zdname</rename>
@@ -712,6 +718,29 @@ @@ -712,6 +718,29 @@
712 </GUI> 718 </GUI>
713 </step> 719 </step>
714 720
  721 + <step>
  722 + <name>&#x53bb;&#x9664;&#x91cd;&#x590d;&#x8bb0;&#x5f55;</name>
  723 + <type>Unique</type>
  724 + <description/>
  725 + <distribute>Y</distribute>
  726 + <custom_distribution/>
  727 + <copies>1</copies>
  728 + <partitioning>
  729 + <method>none</method>
  730 + <schema_name/>
  731 + </partitioning>
  732 + <count_rows>N</count_rows>
  733 + <count_field/>
  734 + <reject_duplicate_row>N</reject_duplicate_row>
  735 + <error_description/>
  736 + <fields> </fields> <cluster_schema/>
  737 + <remotesteps> <input> </input> <output> </output> </remotesteps> <GUI>
  738 + <xloc>842</xloc>
  739 + <yloc>592</yloc>
  740 + <draw>Y</draw>
  741 + </GUI>
  742 + </step>
  743 +
715 <step_error_handling> 744 <step_error_handling>
716 </step_error_handling> 745 </step_error_handling>
717 <slave-step-copy-partition-distribution> 746 <slave-step-copy-partition-distribution>