Commit c8dba8b918e74db1710c4a2cf26285282b4f003b
Merge branch 'minhang' of http://222.66.0.204:8090/panzhaov5/bsth_control into minhang
# Conflicts: # src/main/java/com/bsth/data/gpsdata/client/ClientApp.java
Showing
13 changed files
with
1027 additions
and
792 deletions
Too many changes to show.
To preserve performance only 13 of 22 files are displayed.
src/main/java/com/bsth/controller/report/ReportController.java
| ... | ... | @@ -12,6 +12,7 @@ import org.springframework.web.bind.annotation.RequestMethod; |
| 12 | 12 | import org.springframework.web.bind.annotation.RequestParam; |
| 13 | 13 | import org.springframework.web.bind.annotation.RestController; |
| 14 | 14 | |
| 15 | +import com.bsth.entity.StationRoute; | |
| 15 | 16 | import com.bsth.entity.excep.ArrivalInfo; |
| 16 | 17 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 17 | 18 | import com.bsth.service.report.ReportService; |
| ... | ... | @@ -75,6 +76,17 @@ public class ReportController { |
| 75 | 76 | } |
| 76 | 77 | |
| 77 | 78 | |
| 79 | + @RequestMapping(value="/queryStrinon" ,method = RequestMethod.GET) | |
| 80 | + public List<StationRoute> queryStrinon(@RequestParam String line, | |
| 81 | + @RequestParam int zd){ | |
| 82 | + return service.queryStrinon(line,zd); | |
| 83 | + } | |
| 84 | + @RequestMapping(value="/queryInOutStrtion" ,method = RequestMethod.GET) | |
| 85 | + public List<Map<String, Object>> queryInOutStrtion(@RequestParam String line, | |
| 86 | + @RequestParam String date,@RequestParam int zd,@RequestParam String lzsj){ | |
| 87 | + return service.queryInOutStrtion(line,date,zd,lzsj); | |
| 88 | + } | |
| 89 | + | |
| 78 | 90 | @RequestMapping(value="/queryListClzd" ,method = RequestMethod.GET) |
| 79 | 91 | public List<ArrivalInfo> queryListClzd(@RequestParam String zd,@RequestParam String line, |
| 80 | 92 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ |
| ... | ... | @@ -84,6 +96,8 @@ public class ReportController { |
| 84 | 96 | |
| 85 | 97 | |
| 86 | 98 | |
| 99 | + | |
| 100 | + | |
| 87 | 101 | @RequestMapping(value="/exportQueryListClzd" ,method = RequestMethod.GET) |
| 88 | 102 | public List<Map<String, Object>> exportQueryListClzd(@RequestParam String zd,@RequestParam String line, |
| 89 | 103 | @RequestParam String zdlx,@RequestParam String fcsj,@RequestParam String ddsj){ | ... | ... |
src/main/java/com/bsth/data/car_out_info/CarOutInfo.java
| 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 | -} | |
| 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
| 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 | -} | |
| 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/forecast/ArrivalComparator.java
| 1 | -package com.bsth.data.forecast; | |
| 2 | - | |
| 3 | -import com.bsth.data.forecast.entity.ArrivalEntity; | |
| 4 | - | |
| 5 | -import java.util.Comparator; | |
| 6 | - | |
| 7 | -public class ArrivalComparator implements Comparator<ArrivalEntity>{ | |
| 8 | - | |
| 9 | - @Override | |
| 10 | - public int compare(ArrivalEntity a1, ArrivalEntity a2) { | |
| 11 | - return (int) (a1.getTs() - a2.getTs()); | |
| 12 | - } | |
| 13 | -} | |
| 1 | +package com.bsth.data.forecast; | |
| 2 | + | |
| 3 | +import com.bsth.data.forecast.entity.ArrivalEntity; | |
| 4 | + | |
| 5 | +import java.util.Comparator; | |
| 6 | + | |
| 7 | +public class ArrivalComparator implements Comparator<ArrivalEntity>{ | |
| 8 | + | |
| 9 | + @Override | |
| 10 | + public int compare(ArrivalEntity a1, ArrivalEntity a2) { | |
| 11 | + return (int) (a1.getTs() - a2.getTs()); | |
| 12 | + } | |
| 13 | +} | ... | ... |
src/main/java/com/bsth/data/forecast/ArrivalDataLoader.java
| 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; | |
| 12 | - | |
| 13 | -import java.sql.Connection; | |
| 14 | -import java.sql.PreparedStatement; | |
| 15 | -import java.sql.ResultSet; | |
| 16 | -import java.sql.SQLException; | |
| 17 | -import java.util.ArrayList; | |
| 18 | -import java.util.Calendar; | |
| 19 | -import java.util.Collection; | |
| 20 | -import java.util.List; | |
| 21 | - | |
| 22 | -/** | |
| 23 | - * | |
| 24 | - * @ClassName: DataLoader | |
| 25 | - * @Description: TODO(从数据库加载进出站数据) | |
| 26 | - * @author PanZhao | |
| 27 | - * @date 2016年8月19日 上午9:59:21 | |
| 28 | - * | |
| 29 | - */ | |
| 30 | -@Component | |
| 31 | -public class ArrivalDataLoader { | |
| 32 | - | |
| 33 | - private static Long prveLoadTime; | |
| 34 | - | |
| 35 | - private final static long DAY_TIME = 1000 * 60 * 60 * 24; | |
| 36 | - | |
| 37 | - private Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 38 | - | |
| 39 | - @Autowired | |
| 40 | - LineConfigData lineConfigData; | |
| 41 | - | |
| 42 | - /** | |
| 43 | - * | |
| 44 | - * @Title: load | |
| 45 | - * @Description: TODO(根据上次加载时间,查询之后的增量数据) | |
| 46 | - */ | |
| 47 | - public List<ArrivalEntity> load(){ | |
| 48 | - List<ArrivalEntity> list = null; | |
| 49 | - | |
| 50 | - if(null == prveLoadTime) | |
| 51 | - list = recovery(); | |
| 52 | - else{ | |
| 53 | - Calendar cal = Calendar.getInstance(); | |
| 54 | - //周数,表分区字段 | |
| 55 | - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 56 | - | |
| 57 | - Connection conn = null; | |
| 58 | - PreparedStatement ps = null; | |
| 59 | - ResultSet rs = null; | |
| 60 | - | |
| 61 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by create_date"; | |
| 62 | - try{ | |
| 63 | - long t = System.currentTimeMillis(); | |
| 64 | - | |
| 65 | - conn = DBUtils_MS.getConnection(); | |
| 66 | - ps = conn.prepareStatement(sql); | |
| 67 | - ps.setInt(1, weeks_year); | |
| 68 | - ps.setLong(2, prveLoadTime); | |
| 69 | - ps.setLong(3, t); | |
| 70 | - rs = ps.executeQuery(); | |
| 71 | - | |
| 72 | - list = resultSet2Set(rs); | |
| 73 | - | |
| 74 | - prveLoadTime = t; | |
| 75 | - }catch(Exception e){ | |
| 76 | - logger.error("", e); | |
| 77 | - }finally { | |
| 78 | - DBUtils_MS.close(rs, ps, conn); | |
| 79 | - } | |
| 80 | - } | |
| 81 | - return list; | |
| 82 | - } | |
| 83 | - | |
| 84 | - /** | |
| 85 | - * | |
| 86 | - * @Title: recovery | |
| 87 | - * @Description: TODO(从数据库恢复数据,按照线路的开始运营时间恢复) | |
| 88 | - */ | |
| 89 | - public List<ArrivalEntity> recovery(){ | |
| 90 | - Collection<LineConfig> confs = lineConfigData.getAll(); | |
| 91 | - long t = System.currentTimeMillis() | |
| 92 | - ,st; | |
| 93 | - | |
| 94 | - List<ArrivalEntity> all = new ArrayList<>(); | |
| 95 | - for(LineConfig conf : confs){ | |
| 96 | - st = conf.getCurrStartTime(); | |
| 97 | - if(t < st) | |
| 98 | - st = st - DAY_TIME; | |
| 99 | - try{ | |
| 100 | - all.addAll(loadByLineAndTime(conf.getLine().getLineCode(), st, t)); | |
| 101 | - }catch(Exception e){ | |
| 102 | - logger.error("", e); | |
| 103 | - } | |
| 104 | - } | |
| 105 | - | |
| 106 | - prveLoadTime = t; | |
| 107 | - return all; | |
| 108 | - } | |
| 109 | - | |
| 110 | - /** | |
| 111 | - * | |
| 112 | - * @Title: loadByLineAndStartTime | |
| 113 | - * @Description: TODO(根据线路和时间戳加载数据) | |
| 114 | - */ | |
| 115 | - public List<ArrivalEntity> loadByLineAndTime(String lineCode, long st, long et){ | |
| 116 | - Calendar cal = Calendar.getInstance(); | |
| 117 | - cal.setTimeInMillis(st); | |
| 118 | - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 119 | - | |
| 120 | - Connection conn = null; | |
| 121 | - PreparedStatement ps = null; | |
| 122 | - ResultSet rs = null; | |
| 123 | - | |
| 124 | - List<ArrivalEntity> list = new ArrayList<>(); | |
| 125 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | |
| 126 | - try{ | |
| 127 | - conn = DBUtils_MS.getConnection(); | |
| 128 | - ps = conn.prepareStatement(sql); | |
| 129 | - ps.setInt(1, weeks_year); | |
| 130 | - ps.setString(2, lineCode); | |
| 131 | - ps.setLong(3, st); | |
| 132 | - ps.setLong(4, et); | |
| 133 | - rs = ps.executeQuery(); | |
| 134 | - | |
| 135 | - list = resultSet2Set(rs); | |
| 136 | - }catch(Exception e){ | |
| 137 | - logger.error("", e); | |
| 138 | - }finally { | |
| 139 | - DBUtils_MS.close(rs, ps, conn); | |
| 140 | - } | |
| 141 | - return list; | |
| 142 | - } | |
| 143 | - | |
| 144 | - /** | |
| 145 | - * | |
| 146 | - * @Title: loadByLineAndStartTime | |
| 147 | - * @Description: TODO(根据线路,走向和时间戳加载数据) | |
| 148 | - */ | |
| 149 | - public List<ArrivalEntity> loadByLineAndTime(String lineCode, int updown, long st, long et){ | |
| 150 | - Calendar cal = Calendar.getInstance(); | |
| 151 | - cal.setTimeInMillis(st); | |
| 152 | - int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 153 | - | |
| 154 | - Connection conn = null; | |
| 155 | - PreparedStatement ps = null; | |
| 156 | - ResultSet rs = null; | |
| 157 | - | |
| 158 | - List<ArrivalEntity> list = new ArrayList<>(); | |
| 159 | - String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? and up_down=? and in_out=0 AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | |
| 160 | - try{ | |
| 161 | - conn = DBUtils_MS.getConnection(); | |
| 162 | - ps = conn.prepareStatement(sql); | |
| 163 | - ps.setInt(1, weeks_year); | |
| 164 | - ps.setString(2, lineCode); | |
| 165 | - ps.setInt(3, updown); | |
| 166 | - ps.setLong(4, st); | |
| 167 | - ps.setLong(5, et); | |
| 168 | - rs = ps.executeQuery(); | |
| 169 | - | |
| 170 | - list = resultSet2Set(rs); | |
| 171 | - }catch(Exception e){ | |
| 172 | - logger.error("", e); | |
| 173 | - }finally { | |
| 174 | - DBUtils_MS.close(rs, ps, conn); | |
| 175 | - } | |
| 176 | - return list; | |
| 177 | - } | |
| 178 | - | |
| 179 | - public List<ArrivalEntity> resultSet2Set(ResultSet rs) throws SQLException{ | |
| 180 | - List<ArrivalEntity> list = new ArrayList<>(); | |
| 181 | - | |
| 182 | - ArrivalEntity arr; | |
| 183 | - while(rs.next()){ | |
| 184 | - arr = new ArrivalEntity(); | |
| 185 | - arr.setDeviceId(rs.getString("device_id")); | |
| 186 | - arr.setNbbm(BasicData.deviceId2NbbmMap.get(arr.getDeviceId())); | |
| 187 | - if(null == arr.getNbbm()){ | |
| 188 | - logger.warn("未注册的设备号," + arr.getDeviceId()); | |
| 189 | - continue; | |
| 190 | - } | |
| 191 | - | |
| 192 | - arr.setTs(rs.getLong("ts")); | |
| 193 | - arr.setLineCode(rs.getString("line_id")); | |
| 194 | - arr.setUpDown(rs.getInt("up_down")); | |
| 195 | - arr.setStopNo(rs.getString("stop_no")); | |
| 196 | - arr.setStopName(BasicData.stationCode2NameMap.get(arr.getStopNo())); | |
| 197 | - arr.setInOut(rs.getInt("in_out")); | |
| 198 | - arr.setCreateDate(rs.getLong("create_timestamp")); | |
| 199 | - arr.setWeeksYear(rs.getInt("weeks_year")); | |
| 200 | - arr.setEnable(true); | |
| 201 | - | |
| 202 | - list.add(arr); | |
| 203 | - } | |
| 204 | - return list; | |
| 205 | - } | |
| 206 | - | |
| 207 | - public static void setPrveLoadTime(long t){ | |
| 208 | - prveLoadTime = t; | |
| 209 | - } | |
| 210 | -} | |
| 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; | |
| 12 | + | |
| 13 | +import java.sql.Connection; | |
| 14 | +import java.sql.PreparedStatement; | |
| 15 | +import java.sql.ResultSet; | |
| 16 | +import java.sql.SQLException; | |
| 17 | +import java.util.ArrayList; | |
| 18 | +import java.util.Calendar; | |
| 19 | +import java.util.Collection; | |
| 20 | +import java.util.List; | |
| 21 | + | |
| 22 | +/** | |
| 23 | + * | |
| 24 | + * @ClassName: DataLoader | |
| 25 | + * @Description: TODO(从数据库加载进出站数据) | |
| 26 | + * @author PanZhao | |
| 27 | + * @date 2016年8月19日 上午9:59:21 | |
| 28 | + * | |
| 29 | + */ | |
| 30 | +@Component | |
| 31 | +public class ArrivalDataLoader { | |
| 32 | + | |
| 33 | + private static Long prveLoadTime; | |
| 34 | + | |
| 35 | + private final static long DAY_TIME = 1000 * 60 * 60 * 24; | |
| 36 | + | |
| 37 | + private Logger logger = LoggerFactory.getLogger(this.getClass()); | |
| 38 | + | |
| 39 | + @Autowired | |
| 40 | + LineConfigData lineConfigData; | |
| 41 | + | |
| 42 | + /** | |
| 43 | + * | |
| 44 | + * @Title: load | |
| 45 | + * @Description: TODO(根据上次加载时间,查询之后的增量数据) | |
| 46 | + */ | |
| 47 | + public List<ArrivalEntity> load(){ | |
| 48 | + List<ArrivalEntity> list = null; | |
| 49 | + | |
| 50 | + if(null == prveLoadTime) | |
| 51 | + list = recovery(); | |
| 52 | + else{ | |
| 53 | + Calendar cal = Calendar.getInstance(); | |
| 54 | + //周数,表分区字段 | |
| 55 | + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 56 | + | |
| 57 | + Connection conn = null; | |
| 58 | + PreparedStatement ps = null; | |
| 59 | + ResultSet rs = null; | |
| 60 | + | |
| 61 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by create_date"; | |
| 62 | + try{ | |
| 63 | + long t = System.currentTimeMillis(); | |
| 64 | + | |
| 65 | + conn = DBUtils_MS.getConnection(); | |
| 66 | + ps = conn.prepareStatement(sql); | |
| 67 | + ps.setInt(1, weeks_year); | |
| 68 | + ps.setLong(2, prveLoadTime); | |
| 69 | + ps.setLong(3, t); | |
| 70 | + rs = ps.executeQuery(); | |
| 71 | + | |
| 72 | + list = resultSet2Set(rs); | |
| 73 | + | |
| 74 | + prveLoadTime = t; | |
| 75 | + }catch(Exception e){ | |
| 76 | + logger.error("", e); | |
| 77 | + }finally { | |
| 78 | + DBUtils_MS.close(rs, ps, conn); | |
| 79 | + } | |
| 80 | + } | |
| 81 | + return list; | |
| 82 | + } | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * | |
| 86 | + * @Title: recovery | |
| 87 | + * @Description: TODO(从数据库恢复数据,按照线路的开始运营时间恢复) | |
| 88 | + */ | |
| 89 | + public List<ArrivalEntity> recovery(){ | |
| 90 | + Collection<LineConfig> confs = lineConfigData.getAll(); | |
| 91 | + long t = System.currentTimeMillis() | |
| 92 | + ,st; | |
| 93 | + | |
| 94 | + List<ArrivalEntity> all = new ArrayList<>(); | |
| 95 | + for(LineConfig conf : confs){ | |
| 96 | + st = conf.getCurrStartTime(); | |
| 97 | + if(t < st) | |
| 98 | + st = st - DAY_TIME; | |
| 99 | + try{ | |
| 100 | + all.addAll(loadByLineAndTime(conf.getLine().getLineCode(), st, t)); | |
| 101 | + }catch(Exception e){ | |
| 102 | + logger.error("", e); | |
| 103 | + } | |
| 104 | + } | |
| 105 | + | |
| 106 | + prveLoadTime = t; | |
| 107 | + return all; | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * | |
| 112 | + * @Title: loadByLineAndStartTime | |
| 113 | + * @Description: TODO(根据线路和时间戳加载数据) | |
| 114 | + */ | |
| 115 | + public List<ArrivalEntity> loadByLineAndTime(String lineCode, long st, long et){ | |
| 116 | + Calendar cal = Calendar.getInstance(); | |
| 117 | + cal.setTimeInMillis(st); | |
| 118 | + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 119 | + | |
| 120 | + Connection conn = null; | |
| 121 | + PreparedStatement ps = null; | |
| 122 | + ResultSet rs = null; | |
| 123 | + | |
| 124 | + List<ArrivalEntity> list = new ArrayList<>(); | |
| 125 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | |
| 126 | + try{ | |
| 127 | + conn = DBUtils_MS.getConnection(); | |
| 128 | + ps = conn.prepareStatement(sql); | |
| 129 | + ps.setInt(1, weeks_year); | |
| 130 | + ps.setString(2, lineCode); | |
| 131 | + ps.setLong(3, st); | |
| 132 | + ps.setLong(4, et); | |
| 133 | + rs = ps.executeQuery(); | |
| 134 | + | |
| 135 | + list = resultSet2Set(rs); | |
| 136 | + }catch(Exception e){ | |
| 137 | + logger.error("", e); | |
| 138 | + }finally { | |
| 139 | + DBUtils_MS.close(rs, ps, conn); | |
| 140 | + } | |
| 141 | + return list; | |
| 142 | + } | |
| 143 | + | |
| 144 | + /** | |
| 145 | + * | |
| 146 | + * @Title: loadByLineAndStartTime | |
| 147 | + * @Description: TODO(根据线路,走向和时间戳加载数据) | |
| 148 | + */ | |
| 149 | + public List<ArrivalEntity> loadByLineAndTime(String lineCode, int updown, long st, long et){ | |
| 150 | + Calendar cal = Calendar.getInstance(); | |
| 151 | + cal.setTimeInMillis(st); | |
| 152 | + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR); | |
| 153 | + | |
| 154 | + Connection conn = null; | |
| 155 | + PreparedStatement ps = null; | |
| 156 | + ResultSet rs = null; | |
| 157 | + | |
| 158 | + List<ArrivalEntity> list = new ArrayList<>(); | |
| 159 | + String sql = "select * from bsth_c_arrival_info where weeks_year=? and line_id=? and up_down=? and in_out=0 AND create_timestamp > ? AND create_timestamp <=? AND ABS(create_timestamp - ts) < 3600000 order by ts"; | |
| 160 | + try{ | |
| 161 | + conn = DBUtils_MS.getConnection(); | |
| 162 | + ps = conn.prepareStatement(sql); | |
| 163 | + ps.setInt(1, weeks_year); | |
| 164 | + ps.setString(2, lineCode); | |
| 165 | + ps.setInt(3, updown); | |
| 166 | + ps.setLong(4, st); | |
| 167 | + ps.setLong(5, et); | |
| 168 | + rs = ps.executeQuery(); | |
| 169 | + | |
| 170 | + list = resultSet2Set(rs); | |
| 171 | + }catch(Exception e){ | |
| 172 | + logger.error("", e); | |
| 173 | + }finally { | |
| 174 | + DBUtils_MS.close(rs, ps, conn); | |
| 175 | + } | |
| 176 | + return list; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public List<ArrivalEntity> resultSet2Set(ResultSet rs) throws SQLException{ | |
| 180 | + List<ArrivalEntity> list = new ArrayList<>(); | |
| 181 | + | |
| 182 | + ArrivalEntity arr; | |
| 183 | + while(rs.next()){ | |
| 184 | + arr = new ArrivalEntity(); | |
| 185 | + arr.setDeviceId(rs.getString("device_id")); | |
| 186 | + arr.setNbbm(BasicData.deviceId2NbbmMap.get(arr.getDeviceId())); | |
| 187 | + if(null == arr.getNbbm()){ | |
| 188 | + logger.warn("未注册的设备号," + arr.getDeviceId()); | |
| 189 | + continue; | |
| 190 | + } | |
| 191 | + | |
| 192 | + arr.setTs(rs.getLong("ts")); | |
| 193 | + arr.setLineCode(rs.getString("line_id")); | |
| 194 | + arr.setUpDown(rs.getInt("up_down")); | |
| 195 | + arr.setStopNo(rs.getString("stop_no")); | |
| 196 | + arr.setStopName(BasicData.stationCode2NameMap.get(arr.getStopNo())); | |
| 197 | + arr.setInOut(rs.getInt("in_out")); | |
| 198 | + arr.setCreateDate(rs.getLong("create_timestamp")); | |
| 199 | + arr.setWeeksYear(rs.getInt("weeks_year")); | |
| 200 | + arr.setEnable(true); | |
| 201 | + | |
| 202 | + list.add(arr); | |
| 203 | + } | |
| 204 | + return list; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public static void setPrveLoadTime(long t){ | |
| 208 | + prveLoadTime = t; | |
| 209 | + } | |
| 210 | +} | ... | ... |
src/main/java/com/bsth/data/forecast/entity/ArrivalEntity.java
| 1 | -package com.bsth.data.forecast.entity; | |
| 2 | - | |
| 3 | -import com.bsth.data.BasicData; | |
| 4 | - | |
| 5 | -import java.text.SimpleDateFormat; | |
| 6 | -import java.util.Date; | |
| 7 | - | |
| 8 | -/** | |
| 9 | - * | |
| 10 | - * @ClassName: ArrivalEntity | |
| 11 | - * @Description: TODO(进出站实体) | |
| 12 | - * @author PanZhao | |
| 13 | - * @date 2016年8月19日 上午9:32:20 | |
| 14 | - * | |
| 15 | - */ | |
| 16 | -public class ArrivalEntity { | |
| 17 | - | |
| 18 | - /** 设备号*/ | |
| 19 | - private String deviceId; | |
| 20 | - | |
| 21 | - private String nbbm; | |
| 22 | - | |
| 23 | - /** 站点名称 */ | |
| 24 | - private String stopName; | |
| 25 | - | |
| 26 | - /** 时间戳*/ | |
| 27 | - private Long ts; | |
| 28 | - | |
| 29 | - /** 线路编码*/ | |
| 30 | - private String lineCode; | |
| 31 | - | |
| 32 | - /** 上下行*/ | |
| 33 | - private Integer upDown; | |
| 34 | - | |
| 35 | - /**站点编码*/ | |
| 36 | - private String stopNo; | |
| 37 | - | |
| 38 | - /** 0: 进 1:出*/ | |
| 39 | - private Integer inOut; | |
| 40 | - | |
| 41 | - private Long createDate; | |
| 42 | - | |
| 43 | - /** 是否有效 */ | |
| 44 | - private boolean enable; | |
| 45 | - | |
| 46 | - /**分区字段,当年的第几周*/ | |
| 47 | - private Integer weeksYear; | |
| 48 | - | |
| 49 | - private boolean tcc; | |
| 50 | - | |
| 51 | - //是否被纠正 | |
| 52 | - private boolean correct; | |
| 53 | - | |
| 54 | - private String correctText; | |
| 55 | - | |
| 56 | - /** -1 则信号有效,但程序标记为不使用 */ | |
| 57 | - private int flag = 0; | |
| 58 | - | |
| 59 | - public ArrivalEntity(){} | |
| 60 | - | |
| 61 | - public ArrivalEntity(String deviceId, long ts, String lineCode, int upDown, String stopNo, int inOut, long createDate, | |
| 62 | - int weeksYear, String stopName) { | |
| 63 | - | |
| 64 | - this.deviceId = deviceId; | |
| 65 | - this.ts = ts; | |
| 66 | - this.lineCode = lineCode; | |
| 67 | - this.upDown = upDown; | |
| 68 | - this.stopNo = stopNo; | |
| 69 | - this.stopName = stopName; | |
| 70 | - this.inOut = inOut; | |
| 71 | - this.createDate = createDate; | |
| 72 | - } | |
| 73 | - | |
| 74 | -/* @Override | |
| 75 | - public boolean equals(Object obj) { | |
| 76 | - ArrivalEntity a2 = (ArrivalEntity)obj; | |
| 77 | - | |
| 78 | - return this.toString().equals(a2.toString()) | |
| 79 | - && Math.abs(this.ts - a2.ts) < EQ_RANGE; | |
| 80 | - } | |
| 81 | - | |
| 82 | - @Override | |
| 83 | - public int hashCode() { | |
| 84 | - return this.toString().hashCode(); | |
| 85 | - }*/ | |
| 86 | - | |
| 87 | - | |
| 88 | - @Override | |
| 89 | - public String toString() { | |
| 90 | - try { | |
| 91 | - SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 92 | - return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+sdfHHmm.format(new Date(this.ts)) | |
| 93 | - +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]"; | |
| 94 | - } catch (Exception e) { | |
| 95 | - return ""; | |
| 96 | - } | |
| 97 | - } | |
| 98 | - | |
| 99 | - public String getLineCode() { | |
| 100 | - return lineCode; | |
| 101 | - } | |
| 102 | - | |
| 103 | - public void setLineCode(String lineCode) { | |
| 104 | - this.lineCode = lineCode; | |
| 105 | - } | |
| 106 | - | |
| 107 | - public Integer getUpDown() { | |
| 108 | - return upDown; | |
| 109 | - } | |
| 110 | - | |
| 111 | - public void setUpDown(Integer upDown) { | |
| 112 | - this.upDown = upDown; | |
| 113 | - } | |
| 114 | - | |
| 115 | - public String getStopNo() { | |
| 116 | - return stopNo; | |
| 117 | - } | |
| 118 | - | |
| 119 | - public void setStopNo(String stopNo) { | |
| 120 | - this.stopNo = stopNo; | |
| 121 | - } | |
| 122 | - | |
| 123 | - public Integer getInOut() { | |
| 124 | - return inOut; | |
| 125 | - } | |
| 126 | - | |
| 127 | - public void setInOut(Integer inOut) { | |
| 128 | - this.inOut = inOut; | |
| 129 | - } | |
| 130 | - | |
| 131 | - public Long getCreateDate() { | |
| 132 | - return createDate; | |
| 133 | - } | |
| 134 | - | |
| 135 | - public void setCreateDate(Long createDate) { | |
| 136 | - this.createDate = createDate; | |
| 137 | - } | |
| 138 | - | |
| 139 | - public Integer getWeeksYear() { | |
| 140 | - return weeksYear; | |
| 141 | - } | |
| 142 | - | |
| 143 | - public void setWeeksYear(Integer weeksYear) { | |
| 144 | - this.weeksYear = weeksYear; | |
| 145 | - } | |
| 146 | - | |
| 147 | - public String getDeviceId() { | |
| 148 | - return deviceId; | |
| 149 | - } | |
| 150 | - | |
| 151 | - public void setDeviceId(String deviceId) { | |
| 152 | - this.deviceId = deviceId; | |
| 153 | - } | |
| 154 | - | |
| 155 | - public Long getTs() { | |
| 156 | - return ts; | |
| 157 | - } | |
| 158 | - | |
| 159 | - public void setTs(Long ts) { | |
| 160 | - this.ts = ts; | |
| 161 | - } | |
| 162 | - | |
| 163 | - public String getStopName() { | |
| 164 | - return stopName; | |
| 165 | - } | |
| 166 | - | |
| 167 | - public void setStopName(String stopName) { | |
| 168 | - this.stopName = stopName; | |
| 169 | - } | |
| 170 | - | |
| 171 | - public String getId(){ | |
| 172 | - return this.deviceId + "_" + this.ts; | |
| 173 | - } | |
| 174 | - | |
| 175 | - public String getNbbm() { | |
| 176 | - return nbbm; | |
| 177 | - } | |
| 178 | - | |
| 179 | - public void setNbbm(String nbbm) { | |
| 180 | - this.nbbm = nbbm; | |
| 181 | - } | |
| 182 | - | |
| 183 | - public boolean isEnable() { | |
| 184 | - return enable; | |
| 185 | - } | |
| 186 | - | |
| 187 | - public void setEnable(boolean enable) { | |
| 188 | - this.enable = enable; | |
| 189 | - } | |
| 190 | - | |
| 191 | - public boolean isTcc() { | |
| 192 | - return tcc; | |
| 193 | - } | |
| 194 | - | |
| 195 | - public void setTcc(boolean tcc) { | |
| 196 | - this.tcc = tcc; | |
| 197 | - } | |
| 198 | - | |
| 199 | - public boolean isOutTcc() { | |
| 200 | - return isTcc() && inOut == 1; | |
| 201 | - } | |
| 202 | - | |
| 203 | - public boolean isCorrect() { | |
| 204 | - return correct; | |
| 205 | - } | |
| 206 | - | |
| 207 | - public void setCorrect(boolean correct) { | |
| 208 | - this.correct = correct; | |
| 209 | - } | |
| 210 | - | |
| 211 | - public String getCorrectText() { | |
| 212 | - return correctText; | |
| 213 | - } | |
| 214 | - | |
| 215 | - public void setCorrectText(String correctText) { | |
| 216 | - this.correctText = correctText; | |
| 217 | - } | |
| 218 | - | |
| 219 | - public Integer getFlag() { | |
| 220 | - return flag; | |
| 221 | - } | |
| 222 | - | |
| 223 | - public void setFlag(Integer flag) { | |
| 224 | - this.flag = flag; | |
| 225 | - } | |
| 226 | -} | |
| 1 | +package com.bsth.data.forecast.entity; | |
| 2 | + | |
| 3 | +import com.bsth.data.BasicData; | |
| 4 | + | |
| 5 | +import java.text.SimpleDateFormat; | |
| 6 | +import java.util.Date; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * | |
| 10 | + * @ClassName: ArrivalEntity | |
| 11 | + * @Description: TODO(进出站实体) | |
| 12 | + * @author PanZhao | |
| 13 | + * @date 2016年8月19日 上午9:32:20 | |
| 14 | + * | |
| 15 | + */ | |
| 16 | +public class ArrivalEntity { | |
| 17 | + | |
| 18 | + /** 设备号*/ | |
| 19 | + private String deviceId; | |
| 20 | + | |
| 21 | + private String nbbm; | |
| 22 | + | |
| 23 | + /** 站点名称 */ | |
| 24 | + private String stopName; | |
| 25 | + | |
| 26 | + /** 时间戳*/ | |
| 27 | + private Long ts; | |
| 28 | + | |
| 29 | + /** 线路编码*/ | |
| 30 | + private String lineCode; | |
| 31 | + | |
| 32 | + /** 上下行*/ | |
| 33 | + private Integer upDown; | |
| 34 | + | |
| 35 | + /**站点编码*/ | |
| 36 | + private String stopNo; | |
| 37 | + | |
| 38 | + /** 0: 进 1:出*/ | |
| 39 | + private Integer inOut; | |
| 40 | + | |
| 41 | + private Long createDate; | |
| 42 | + | |
| 43 | + /** 是否有效 */ | |
| 44 | + private boolean enable; | |
| 45 | + | |
| 46 | + /**分区字段,当年的第几周*/ | |
| 47 | + private Integer weeksYear; | |
| 48 | + | |
| 49 | + private boolean tcc; | |
| 50 | + | |
| 51 | + //是否被纠正 | |
| 52 | + private boolean correct; | |
| 53 | + | |
| 54 | + private String correctText; | |
| 55 | + | |
| 56 | + /** -1 则信号有效,但程序标记为不使用 */ | |
| 57 | + private int flag = 0; | |
| 58 | + | |
| 59 | + public ArrivalEntity(){} | |
| 60 | + | |
| 61 | + public ArrivalEntity(String deviceId, long ts, String lineCode, int upDown, String stopNo, int inOut, long createDate, | |
| 62 | + int weeksYear, String stopName) { | |
| 63 | + | |
| 64 | + this.deviceId = deviceId; | |
| 65 | + this.ts = ts; | |
| 66 | + this.lineCode = lineCode; | |
| 67 | + this.upDown = upDown; | |
| 68 | + this.stopNo = stopNo; | |
| 69 | + this.stopName = stopName; | |
| 70 | + this.inOut = inOut; | |
| 71 | + this.createDate = createDate; | |
| 72 | + } | |
| 73 | + | |
| 74 | +/* @Override | |
| 75 | + public boolean equals(Object obj) { | |
| 76 | + ArrivalEntity a2 = (ArrivalEntity)obj; | |
| 77 | + | |
| 78 | + return this.toString().equals(a2.toString()) | |
| 79 | + && Math.abs(this.ts - a2.ts) < EQ_RANGE; | |
| 80 | + } | |
| 81 | + | |
| 82 | + @Override | |
| 83 | + public int hashCode() { | |
| 84 | + return this.toString().hashCode(); | |
| 85 | + }*/ | |
| 86 | + | |
| 87 | + | |
| 88 | + @Override | |
| 89 | + public String toString() { | |
| 90 | + try { | |
| 91 | + SimpleDateFormat sdfHHmm = new SimpleDateFormat("HH:mm"); | |
| 92 | + return "["+BasicData.deviceId2NbbmMap.get(this.deviceId)+", "+sdfHHmm.format(new Date(this.ts)) | |
| 93 | + +","+(this.getUpDown()==0?"上行":"下行")+","+(this.inOut==0?"进":"出")+","+this.stopNo+" ("+this.stopName+")]"; | |
| 94 | + } catch (Exception e) { | |
| 95 | + return ""; | |
| 96 | + } | |
| 97 | + } | |
| 98 | + | |
| 99 | + public String getLineCode() { | |
| 100 | + return lineCode; | |
| 101 | + } | |
| 102 | + | |
| 103 | + public void setLineCode(String lineCode) { | |
| 104 | + this.lineCode = lineCode; | |
| 105 | + } | |
| 106 | + | |
| 107 | + public Integer getUpDown() { | |
| 108 | + return upDown; | |
| 109 | + } | |
| 110 | + | |
| 111 | + public void setUpDown(Integer upDown) { | |
| 112 | + this.upDown = upDown; | |
| 113 | + } | |
| 114 | + | |
| 115 | + public String getStopNo() { | |
| 116 | + return stopNo; | |
| 117 | + } | |
| 118 | + | |
| 119 | + public void setStopNo(String stopNo) { | |
| 120 | + this.stopNo = stopNo; | |
| 121 | + } | |
| 122 | + | |
| 123 | + public Integer getInOut() { | |
| 124 | + return inOut; | |
| 125 | + } | |
| 126 | + | |
| 127 | + public void setInOut(Integer inOut) { | |
| 128 | + this.inOut = inOut; | |
| 129 | + } | |
| 130 | + | |
| 131 | + public Long getCreateDate() { | |
| 132 | + return createDate; | |
| 133 | + } | |
| 134 | + | |
| 135 | + public void setCreateDate(Long createDate) { | |
| 136 | + this.createDate = createDate; | |
| 137 | + } | |
| 138 | + | |
| 139 | + public Integer getWeeksYear() { | |
| 140 | + return weeksYear; | |
| 141 | + } | |
| 142 | + | |
| 143 | + public void setWeeksYear(Integer weeksYear) { | |
| 144 | + this.weeksYear = weeksYear; | |
| 145 | + } | |
| 146 | + | |
| 147 | + public String getDeviceId() { | |
| 148 | + return deviceId; | |
| 149 | + } | |
| 150 | + | |
| 151 | + public void setDeviceId(String deviceId) { | |
| 152 | + this.deviceId = deviceId; | |
| 153 | + } | |
| 154 | + | |
| 155 | + public Long getTs() { | |
| 156 | + return ts; | |
| 157 | + } | |
| 158 | + | |
| 159 | + public void setTs(Long ts) { | |
| 160 | + this.ts = ts; | |
| 161 | + } | |
| 162 | + | |
| 163 | + public String getStopName() { | |
| 164 | + return stopName; | |
| 165 | + } | |
| 166 | + | |
| 167 | + public void setStopName(String stopName) { | |
| 168 | + this.stopName = stopName; | |
| 169 | + } | |
| 170 | + | |
| 171 | + public String getId(){ | |
| 172 | + return this.deviceId + "_" + this.ts; | |
| 173 | + } | |
| 174 | + | |
| 175 | + public String getNbbm() { | |
| 176 | + return nbbm; | |
| 177 | + } | |
| 178 | + | |
| 179 | + public void setNbbm(String nbbm) { | |
| 180 | + this.nbbm = nbbm; | |
| 181 | + } | |
| 182 | + | |
| 183 | + public boolean isEnable() { | |
| 184 | + return enable; | |
| 185 | + } | |
| 186 | + | |
| 187 | + public void setEnable(boolean enable) { | |
| 188 | + this.enable = enable; | |
| 189 | + } | |
| 190 | + | |
| 191 | + public boolean isTcc() { | |
| 192 | + return tcc; | |
| 193 | + } | |
| 194 | + | |
| 195 | + public void setTcc(boolean tcc) { | |
| 196 | + this.tcc = tcc; | |
| 197 | + } | |
| 198 | + | |
| 199 | + public boolean isOutTcc() { | |
| 200 | + return isTcc() && inOut == 1; | |
| 201 | + } | |
| 202 | + | |
| 203 | + public boolean isCorrect() { | |
| 204 | + return correct; | |
| 205 | + } | |
| 206 | + | |
| 207 | + public void setCorrect(boolean correct) { | |
| 208 | + this.correct = correct; | |
| 209 | + } | |
| 210 | + | |
| 211 | + public String getCorrectText() { | |
| 212 | + return correctText; | |
| 213 | + } | |
| 214 | + | |
| 215 | + public void setCorrectText(String correctText) { | |
| 216 | + this.correctText = correctText; | |
| 217 | + } | |
| 218 | + | |
| 219 | + public Integer getFlag() { | |
| 220 | + return flag; | |
| 221 | + } | |
| 222 | + | |
| 223 | + public void setFlag(Integer flag) { | |
| 224 | + this.flag = flag; | |
| 225 | + } | |
| 226 | +} | ... | ... |
src/main/java/com/bsth/data/gpsdata/client/GpsBeforeBuffer.java
| 1 | -package com.bsth.data.gpsdata.client; | |
| 2 | - | |
| 3 | -import com.bsth.Application; | |
| 4 | -import com.bsth.data.BasicData; | |
| 5 | -import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | -import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 7 | -import com.bsth.data.gpsdata.client.pd.protocol.BasicInfo; | |
| 8 | -import org.apache.commons.lang3.StringUtils; | |
| 9 | -import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | -import org.springframework.stereotype.Component; | |
| 11 | - | |
| 12 | -import java.util.ArrayList; | |
| 13 | -import java.util.LinkedList; | |
| 14 | -import java.util.List; | |
| 15 | -import java.util.concurrent.TimeUnit; | |
| 16 | - | |
| 17 | -/** | |
| 18 | - * 从 socket client 到 .. 的缓冲 | |
| 19 | - * Created by panzhao on 2017/5/4. | |
| 20 | - */ | |
| 21 | -@Component | |
| 22 | -public class GpsBeforeBuffer { | |
| 23 | - | |
| 24 | - static LinkedList<GpsEntity> linkedList = new LinkedList<>(); | |
| 25 | - | |
| 26 | - @Autowired | |
| 27 | - GpsHandleThread gpsHandleThread; | |
| 28 | - | |
| 29 | - public void put(BasicInfo basicInfo){ | |
| 30 | - //放弃补发数据 | |
| 31 | - byte cacheData = getCacheState(basicInfo.getServiceState()); | |
| 32 | - if(cacheData == 1) | |
| 33 | - return; | |
| 34 | - GpsEntity gps = new GpsEntity(); | |
| 35 | - | |
| 36 | - gps.setDeviceId(basicInfo.getDeviceId()); | |
| 37 | - gps.setTimestamp(basicInfo.getTimestamp()); | |
| 38 | - gps.setLat(basicInfo.getLat()); | |
| 39 | - gps.setLon(basicInfo.getLon()); | |
| 40 | - gps.setDirection((float)basicInfo.getDirection() / 10); | |
| 41 | - gps.setValid(basicInfo.getGpsValid()); | |
| 42 | - gps.setCompanyCode(basicInfo.getCompanyCode()); | |
| 43 | - gps.setStopNo(basicInfo.getStopNo()); | |
| 44 | - gps.setUpDown(basicInfo.getUpOrDown()); | |
| 45 | - gps.setSpeed((float)basicInfo.getSpeedGps() / 10); | |
| 46 | - gps.setLineId(String.valueOf(basicInfo.getLineId())); | |
| 47 | - gps.setState((int) getService(basicInfo.getServiceState())); | |
| 48 | - //没有设备号 | |
| 49 | - if (StringUtils.isBlank(gps.getDeviceId())) | |
| 50 | - return; | |
| 51 | - | |
| 52 | - String nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | |
| 53 | - if (StringUtils.isBlank(nbbm)) | |
| 54 | - gps.setIncomplete(true); | |
| 55 | - else | |
| 56 | - gps.setNbbm(nbbm); | |
| 57 | - | |
| 58 | - linkedList.addLast(gps); | |
| 59 | - } | |
| 60 | - | |
| 61 | - public byte getCacheState(long serviceState) { | |
| 62 | - return (byte)(((serviceState & 0x00100000) == 0x00100000) ? 1 : 0); | |
| 63 | - } | |
| 64 | - | |
| 65 | - public void init(){ | |
| 66 | - Application.mainServices.scheduleWithFixedDelay(gpsHandleThread, 20 * 1000, 1100, TimeUnit.MILLISECONDS); | |
| 67 | - } | |
| 68 | - | |
| 69 | - @Component | |
| 70 | - public static class GpsHandleThread extends Thread{ | |
| 71 | - | |
| 72 | - List<GpsEntity> list; | |
| 73 | - | |
| 74 | - @Autowired | |
| 75 | - GpsRealAnalyse gpsRealAnalyse; | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public void run() { | |
| 79 | - list = new ArrayList<>(100); | |
| 80 | - | |
| 81 | - GpsEntity gps; | |
| 82 | - for(int i = 0; i < 2000; i ++){ | |
| 83 | - gps = linkedList.poll(); | |
| 84 | - if(gps == null) | |
| 85 | - break; | |
| 86 | - list.add(gps); | |
| 87 | - } | |
| 88 | - | |
| 89 | - gpsRealAnalyse.analyse(list); | |
| 90 | - } | |
| 91 | - } | |
| 92 | - | |
| 93 | - /** | |
| 94 | - * 获取运营状态 | |
| 95 | - * | |
| 96 | - * @return -1无效 0运营 1未运营 | |
| 97 | - */ | |
| 98 | - public static byte getService(long serviceState) { | |
| 99 | - if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | |
| 100 | - return -1; | |
| 101 | - return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | |
| 102 | - } | |
| 1 | +package com.bsth.data.gpsdata.client; | |
| 2 | + | |
| 3 | +import com.bsth.Application; | |
| 4 | +import com.bsth.data.BasicData; | |
| 5 | +import com.bsth.data.gpsdata.GpsEntity; | |
| 6 | +import com.bsth.data.gpsdata.arrival.GpsRealAnalyse; | |
| 7 | +import com.bsth.data.gpsdata.client.pd.protocol.BasicInfo; | |
| 8 | +import org.apache.commons.lang3.StringUtils; | |
| 9 | +import org.springframework.beans.factory.annotation.Autowired; | |
| 10 | +import org.springframework.stereotype.Component; | |
| 11 | + | |
| 12 | +import java.util.ArrayList; | |
| 13 | +import java.util.LinkedList; | |
| 14 | +import java.util.List; | |
| 15 | +import java.util.concurrent.TimeUnit; | |
| 16 | + | |
| 17 | +/** | |
| 18 | + * 从 socket client 到 .. 的缓冲 | |
| 19 | + * Created by panzhao on 2017/5/4. | |
| 20 | + */ | |
| 21 | +@Component | |
| 22 | +public class GpsBeforeBuffer { | |
| 23 | + | |
| 24 | + static LinkedList<GpsEntity> linkedList = new LinkedList<>(); | |
| 25 | + | |
| 26 | + @Autowired | |
| 27 | + GpsHandleThread gpsHandleThread; | |
| 28 | + | |
| 29 | + public void put(BasicInfo basicInfo){ | |
| 30 | + //放弃补发数据 | |
| 31 | + byte cacheData = getCacheState(basicInfo.getServiceState()); | |
| 32 | + if(cacheData == 1) | |
| 33 | + return; | |
| 34 | + GpsEntity gps = new GpsEntity(); | |
| 35 | + | |
| 36 | + gps.setDeviceId(basicInfo.getDeviceId()); | |
| 37 | + gps.setTimestamp(basicInfo.getTimestamp()); | |
| 38 | + gps.setLat(basicInfo.getLat()); | |
| 39 | + gps.setLon(basicInfo.getLon()); | |
| 40 | + gps.setDirection((float)basicInfo.getDirection() / 10); | |
| 41 | + gps.setValid(basicInfo.getGpsValid()); | |
| 42 | + gps.setCompanyCode(basicInfo.getCompanyCode()); | |
| 43 | + gps.setStopNo(basicInfo.getStopNo()); | |
| 44 | + gps.setUpDown(basicInfo.getUpOrDown()); | |
| 45 | + gps.setSpeed((float)basicInfo.getSpeedGps() / 10); | |
| 46 | + gps.setLineId(String.valueOf(basicInfo.getLineId())); | |
| 47 | + gps.setState((int) getService(basicInfo.getServiceState())); | |
| 48 | + //没有设备号 | |
| 49 | + if (StringUtils.isBlank(gps.getDeviceId())) | |
| 50 | + return; | |
| 51 | + | |
| 52 | + String nbbm = BasicData.deviceId2NbbmMap.get(gps.getDeviceId()); | |
| 53 | + if (StringUtils.isBlank(nbbm)) | |
| 54 | + gps.setIncomplete(true); | |
| 55 | + else | |
| 56 | + gps.setNbbm(nbbm); | |
| 57 | + | |
| 58 | + linkedList.addLast(gps); | |
| 59 | + } | |
| 60 | + | |
| 61 | + public byte getCacheState(long serviceState) { | |
| 62 | + return (byte)(((serviceState & 0x00100000) == 0x00100000) ? 1 : 0); | |
| 63 | + } | |
| 64 | + | |
| 65 | + public void init(){ | |
| 66 | + Application.mainServices.scheduleWithFixedDelay(gpsHandleThread, 20 * 1000, 1100, TimeUnit.MILLISECONDS); | |
| 67 | + } | |
| 68 | + | |
| 69 | + @Component | |
| 70 | + public static class GpsHandleThread extends Thread{ | |
| 71 | + | |
| 72 | + List<GpsEntity> list; | |
| 73 | + | |
| 74 | + @Autowired | |
| 75 | + GpsRealAnalyse gpsRealAnalyse; | |
| 76 | + | |
| 77 | + @Override | |
| 78 | + public void run() { | |
| 79 | + list = new ArrayList<>(100); | |
| 80 | + | |
| 81 | + GpsEntity gps; | |
| 82 | + for(int i = 0; i < 2000; i ++){ | |
| 83 | + gps = linkedList.poll(); | |
| 84 | + if(gps == null) | |
| 85 | + break; | |
| 86 | + list.add(gps); | |
| 87 | + } | |
| 88 | + | |
| 89 | + gpsRealAnalyse.analyse(list); | |
| 90 | + } | |
| 91 | + } | |
| 92 | + | |
| 93 | + /** | |
| 94 | + * 获取运营状态 | |
| 95 | + * | |
| 96 | + * @return -1无效 0运营 1未运营 | |
| 97 | + */ | |
| 98 | + public static byte getService(long serviceState) { | |
| 99 | + if ((serviceState & 0x00020000) == 0x00020000 || (serviceState & 0x80000000) == 0x80000000) | |
| 100 | + return -1; | |
| 101 | + return (byte) (((serviceState & 0x02000000) == 0x02000000) ? 1 : 0); | |
| 102 | + } | |
| 103 | 103 | } |
| 104 | 104 | \ No newline at end of file | ... | ... |
src/main/java/com/bsth/repository/realcontrol/ScheduleRealInfoRepository.java
| ... | ... | @@ -90,11 +90,11 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 90 | 90 | List<ScheduleRealInfo> correctForm(String line,String startDate,String endDate,String lpName,String code); |
| 91 | 91 | |
| 92 | 92 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 93 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,dfsj") | |
| 93 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jName = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj") | |
| 94 | 94 | List<ScheduleRealInfo> queryListWaybill(String jName,String clZbh,String lpName,String date,String line); |
| 95 | 95 | |
| 96 | 96 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 97 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,dfsj") | |
| 97 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.jGh = ?1 and s.clZbh = ?2 and s.lpName = ?3 and s.scheduleDate = str_to_date(?4,'%Y-%m-%d') and s.xlBm=?5 order by realExecDate,fcsj") | |
| 98 | 98 | List<ScheduleRealInfo> queryListWaybillXcld(String jGh,String clZbh,String lpName,String date,String line); |
| 99 | 99 | |
| 100 | 100 | // @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| ... | ... | @@ -105,9 +105,12 @@ public interface ScheduleRealInfoRepository extends BaseRepository<ScheduleRealI |
| 105 | 105 | @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 order by s.xlBm,s.clZbh,s.jGh,s.adjustExps,s.fcsj") |
| 106 | 106 | List<ScheduleRealInfo> scheduleByDateAndLineTjrb(String line,String date); |
| 107 | 107 | |
| 108 | + @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | |
| 109 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.xlBm = ?1 and DATE_FORMAT(s.scheduleDate,'%Y-%m-%d') = ?2 and s.xlDir=?3 and s.fcsjActual is not null and s.zdsjActual is not null order by s.realExecDate,s.fcsjActual") | |
| 110 | + List<ScheduleRealInfo> scheduleByDateAndLineInOut(String line,String date,String zd); | |
| 108 | 111 | |
| 109 | 112 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) |
| 110 | - @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,dfsj") | |
| 113 | + @Query(value="select DISTINCT s from ScheduleRealInfo s where s.clZbh = ?1 and s.scheduleDate = str_to_date(?2,'%Y-%m-%d') and xlBm =?3 order by realExecDate,fcsj") | |
| 111 | 114 | List<ScheduleRealInfo> queryListWaybill2(String clZbh,String date,String line); |
| 112 | 115 | |
| 113 | 116 | @EntityGraph(value = "scheduleRealInfo_cTasks", type = EntityGraph.EntityGraphType.FETCH) | ... | ... |
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
| ... | ... | @@ -4024,13 +4024,17 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4024 | 4024 | String xlName = map.get("xlName").toString(); |
| 4025 | 4025 | String state = map.get("state").toString(); |
| 4026 | 4026 | String type = map.get("type").toString(); |
| 4027 | - | |
| 4027 | + | |
| 4028 | 4028 | List<Map<String, Object>> dataList2 = new ArrayList<Map<String, Object>>(); |
| 4029 | 4029 | List<Map<String, Object>> dataList3 = new ArrayList<Map<String, Object>>(); |
| 4030 | 4030 | List<Map<String, Object>> list1 = this.statisticsDaily(line, date, xlName, null); |
| 4031 | 4031 | List<ScheduleRealInfo> list2 = this.queryUserInfo(line, date, state); |
| 4032 | 4032 | List<ScheduleRealInfo> list3 = this.realScheduleList(line, date); |
| 4033 | 4033 | |
| 4034 | + Map<String, Object> nMap=new HashMap<String, Object>(); | |
| 4035 | + nMap.put("date", date); | |
| 4036 | + nMap.put("jls", list1.get(0).get("jls")); | |
| 4037 | + nMap.put("sjgl", list1.get(0).get("sjgl")); | |
| 4034 | 4038 | for (Map<String, Object> m : list1) { |
| 4035 | 4039 | // m.put("ssgl", m.get("ssgl")); |
| 4036 | 4040 | // m.put("ssbc", m.get("ssbc")); |
| ... | ... | @@ -4144,7 +4148,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInf |
| 4144 | 4148 | sdfSimple = new SimpleDateFormat("yyyyMM"); |
| 4145 | 4149 | sourcePath = path + "mould/scheduleDaily_m.xls"; |
| 4146 | 4150 | } |
| 4147 | - ee.excelReplace(listI, new Object[]{m}, sourcePath, | |
| 4151 | + ee.excelReplace(listI, new Object[]{nMap}, sourcePath, | |
| 4148 | 4152 | path + "export/调度日报" + sdfSimple.format(sdfMonth.parse(date)) + ".xls"); |
| 4149 | 4153 | } catch (Exception e) { |
| 4150 | 4154 | // TODO: handle exception | ... | ... |
src/main/java/com/bsth/service/report/ReportService.java
| ... | ... | @@ -3,6 +3,7 @@ package com.bsth.service.report; |
| 3 | 3 | import java.util.List; |
| 4 | 4 | import java.util.Map; |
| 5 | 5 | |
| 6 | +import com.bsth.entity.StationRoute; | |
| 6 | 7 | import com.bsth.entity.excep.ArrivalInfo; |
| 7 | 8 | import com.bsth.entity.realcontrol.ScheduleRealInfo; |
| 8 | 9 | |
| ... | ... | @@ -14,7 +15,8 @@ public interface ReportService { |
| 14 | 15 | List<ArrivalInfo> queryListZdxx(String line,String date,String clzbh,String sjfc,String sjdd); |
| 15 | 16 | |
| 16 | 17 | List<ArrivalInfo> queryListClzd(String line,String zd,String zdlx,String fcsj,String ddsj); |
| 17 | - | |
| 18 | + List<StationRoute> queryStrinon(String line,int zd); | |
| 19 | + List<Map<String, Object>> queryInOutStrtion(String line,String date,int zd,String lzsj); | |
| 18 | 20 | List<Map<String, String>> sreachZd(String line,int zdlx,String zd); |
| 19 | 21 | |
| 20 | 22 | List<Object[]> historyMessageCount(String line, String date, String code); | ... | ... |
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
| ... | ... | @@ -59,6 +59,8 @@ public class ReportServiceImpl implements ReportService{ |
| 59 | 59 | CulateMileageService culateService; |
| 60 | 60 | @Autowired |
| 61 | 61 | LineRepository lineRepository; |
| 62 | + @Autowired | |
| 63 | + StationRouteRepository stationRouteRepository; | |
| 62 | 64 | @Override |
| 63 | 65 | public List<ScheduleRealInfo> queryListBczx(String line, String date,String clzbh) { |
| 64 | 66 | // TODO Auto-generated method stub |
| ... | ... | @@ -1469,4 +1471,185 @@ public class ReportServiceImpl implements ReportService{ |
| 1469 | 1471 | } |
| 1470 | 1472 | return list; |
| 1471 | 1473 | } |
| 1474 | + | |
| 1475 | + public List<ArrivalInfo> load3(String line, String date, int zd){ | |
| 1476 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1477 | + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); | |
| 1478 | + Long date1=0L; | |
| 1479 | + Long date2=0L; | |
| 1480 | + Calendar cal = Calendar.getInstance(); | |
| 1481 | + try { | |
| 1482 | + Date dates1 = simpleDateFormat.parse(date+" 00:00:01"); | |
| 1483 | + Date dates2=simpleDateFormat.parse(date+" 23:59:59"); | |
| 1484 | + date1=dates1.getTime(); | |
| 1485 | + date2=dates2.getTime(); | |
| 1486 | + cal.setTime(dates1); | |
| 1487 | + } catch (ParseException e1) { | |
| 1488 | + // TODO Auto-generated catch block | |
| 1489 | + e1.printStackTrace(); | |
| 1490 | + } | |
| 1491 | + //周数,表分区字段 | |
| 1492 | + int weeks_year1 = cal.get(Calendar.WEEK_OF_YEAR); | |
| 1493 | + List<ArrivalInfo> list = null; | |
| 1494 | + Connection conn = null; | |
| 1495 | + PreparedStatement ps = null; | |
| 1496 | + ResultSet rs = null; | |
| 1497 | + | |
| 1498 | + String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? " | |
| 1499 | + + " AND ts >= ? AND ts <=? AND up_down=? order by device_id,ts"; | |
| 1500 | + try{ | |
| 1501 | + conn = DBUtils_MS.getConnection(); | |
| 1502 | + ps = conn.prepareStatement(sql); | |
| 1503 | + ps.setString(1, line); | |
| 1504 | + ps.setInt(2, weeks_year1); | |
| 1505 | + ps.setLong(3, date1); | |
| 1506 | + ps.setLong(4, date2); | |
| 1507 | + ps.setInt(5, zd); | |
| 1508 | + rs = ps.executeQuery(); | |
| 1509 | + | |
| 1510 | + list = resultSet2Set(rs); | |
| 1511 | + }catch(Exception e){ | |
| 1512 | + logger.error("", e); | |
| 1513 | + }finally { | |
| 1514 | + DBUtils_MS.close(rs, ps, conn); | |
| 1515 | + } | |
| 1516 | + return list; | |
| 1517 | + } | |
| 1518 | + @Override | |
| 1519 | + public List<Map<String, Object>> queryInOutStrtion(String line, String date, int zd,String lzsj) { | |
| 1520 | + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); | |
| 1521 | + //查询线路所有的站点 | |
| 1522 | + List<ArrivalInfo> arrInfoList=this.load3(line, date, zd); | |
| 1523 | + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd); | |
| 1524 | + List<Map<String, Object>> inoutList=new ArrayList<Map<String,Object>>(); | |
| 1525 | + //保存的所以的站点信息 | |
| 1526 | + Map<String, Object> map1=new HashMap<String,Object>(); | |
| 1527 | + map1.put("bc", ""); | |
| 1528 | + map1.put("nbbm", ""); | |
| 1529 | + | |
| 1530 | + //所有的班次信息(实际排班排序) | |
| 1531 | + List<ScheduleRealInfo> realList= scheduleRealInfoRepository.scheduleByDateAndLineInOut(line, date,zd+""); | |
| 1532 | + for (int i = 0; i < listStation.size(); i++) { | |
| 1533 | + map1.put(listStation.get(i).getStationCode()+"in" | |
| 1534 | + , listStation.get(i).getStationName()); | |
| 1535 | + map1.put(listStation.get(i).getStationCode()+"out" | |
| 1536 | + , (i+1)); | |
| 1537 | + } | |
| 1538 | + inoutList.add(map1); | |
| 1539 | + | |
| 1540 | + for (int i = 0; i < realList.size(); i++) { | |
| 1541 | + ScheduleRealInfo sinfo=realList.get(i); | |
| 1542 | + String devuceId=BasicData.deviceId2NbbmMap.inverse().get(sinfo.getClZbh()); | |
| 1543 | + String sjfcsj=sinfo.getRealExecDate()+" "+sinfo.getFcsjActual()+":00"; | |
| 1544 | + String sjddsj=sinfo.getRealExecDate()+" "+sinfo.getZdsjActual()+":59"; | |
| 1545 | + | |
| 1546 | + try { | |
| 1547 | + Date dates1 = simpleDateFormat.parse(sjfcsj); | |
| 1548 | + Date dates2=simpleDateFormat.parse(sjddsj); | |
| 1549 | + Long date1=dates1.getTime(); | |
| 1550 | + Long date2=dates2.getTime(); | |
| 1551 | + List<ArrivalInfo> arrList=new ArrayList<ArrivalInfo>(); | |
| 1552 | + for (int j = 0; j < arrInfoList.size(); j++) { | |
| 1553 | + ArrivalInfo a=arrInfoList.get(j); | |
| 1554 | + if(a.getDeviceId().equals(devuceId) && a.getTs()>=date1 && a.getTs()<=date2){ | |
| 1555 | + arrList.add(a); | |
| 1556 | + } | |
| 1557 | + } | |
| 1558 | + | |
| 1559 | + Map<String, Object> map2=new HashMap<String,Object>(); | |
| 1560 | + map2.put("bc", (i+1)); | |
| 1561 | + map2.put("nbbm", sinfo.getClZbh()); | |
| 1562 | + | |
| 1563 | + for (int j = 0; j < listStation.size(); j++) { | |
| 1564 | + StationRoute s=listStation.get(j); | |
| 1565 | + List<ArrivalInfo> arrivalList=new ArrayList<ArrivalInfo>(); | |
| 1566 | + for (int j2 = 0; j2 < arrList.size(); j2++) { | |
| 1567 | + ArrivalInfo a=arrList.get(j2); | |
| 1568 | + if(s.getStationCode().equals(a.getStopNo())){ | |
| 1569 | + arrivalList.add(a); | |
| 1570 | + } | |
| 1571 | + } | |
| 1572 | + Map<String, String> m=this.strInOut(arrivalList,lzsj); | |
| 1573 | + | |
| 1574 | + map2.put(s.getStationCode()+"in", m.get("in")); | |
| 1575 | + map2.put(s.getStationCode()+"out", m.get("out")); | |
| 1576 | + map2.put(s.getStationCode(), m.get("type")); | |
| 1577 | + } | |
| 1578 | + inoutList.add(map2); | |
| 1579 | + } catch (ParseException e) { | |
| 1580 | + // TODO Auto-generated catch block | |
| 1581 | + e.printStackTrace(); | |
| 1582 | + } | |
| 1583 | + } | |
| 1584 | + return inoutList; | |
| 1585 | + } | |
| 1586 | + | |
| 1587 | + public Map<String, String> strInOut(List<ArrivalInfo> lists,String lzsj){ | |
| 1588 | + String inout=""; | |
| 1589 | + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss"); | |
| 1590 | + Long in=0L; | |
| 1591 | + Long out=0L; | |
| 1592 | + for(int i=0;i<lists.size();i++){ | |
| 1593 | + ArrivalInfo t1=lists.get(i); | |
| 1594 | + if(t1.getInOut()==0){ | |
| 1595 | + in=t1.getTs(); | |
| 1596 | + t1.setJzsj(sdf.format(new Date(t1.getTs()))); | |
| 1597 | + for(int j=0;j<lists.size();j++){ | |
| 1598 | + ArrivalInfo t2=lists.get(j); | |
| 1599 | + if(t2.getInOut()==1 && t2.getDeviceId().equals(t1.getDeviceId()) | |
| 1600 | + && t2.getStopNo().equals(t1.getStopNo()) | |
| 1601 | + && t2.getTs()>t1.getTs()){ | |
| 1602 | + t1.setCzsj(sdf.format(new Date(t2.getTs()))); | |
| 1603 | + out =t2.getTs(); | |
| 1604 | + break; | |
| 1605 | + } | |
| 1606 | + } | |
| 1607 | + | |
| 1608 | + }else{ | |
| 1609 | + out =t1.getTs(); | |
| 1610 | + t1.setCzsj(sdf.format(new Date(t1.getTs()))); | |
| 1611 | + for(int j=0;j<lists.size();j++){ | |
| 1612 | + ArrivalInfo t2=lists.get(j); | |
| 1613 | + if(t2.getInOut()==0 && t2.getDeviceId().equals(t1.getDeviceId()) | |
| 1614 | + && t2.getStopNo().equals(t1.getStopNo()) | |
| 1615 | + && t2.getTs()>t1.getTs()){ | |
| 1616 | + in =t2.getTs(); | |
| 1617 | + t1.setJzsj(sdf.format(new Date(t2.getTs()))); | |
| 1618 | + break; | |
| 1619 | + } | |
| 1620 | + } | |
| 1621 | + } | |
| 1622 | + } | |
| 1623 | + | |
| 1624 | + Map<String, String> map=new HashMap<String,String>(); | |
| 1625 | + if(in>0 ){ | |
| 1626 | + map.put("in",sdf.format(new Date(in))); | |
| 1627 | + | |
| 1628 | + }else{ | |
| 1629 | + map.put("in", ""); | |
| 1630 | + } | |
| 1631 | + if(out>0){ | |
| 1632 | + map.put("out", sdf.format(new Date(out))); | |
| 1633 | + }else{ | |
| 1634 | + map.put("out", ""); | |
| 1635 | + } | |
| 1636 | + Long sj=1000000000L; | |
| 1637 | + if(!lzsj.trim().equals("")){ | |
| 1638 | + sj =Long.parseLong(lzsj); | |
| 1639 | + } | |
| 1640 | + if(in>0 && out >0){ | |
| 1641 | + if((out-in)/1000>sj){ | |
| 1642 | + map.put("type", "y"); | |
| 1643 | + }else{ | |
| 1644 | + map.put("type", "n"); | |
| 1645 | + } | |
| 1646 | + } | |
| 1647 | + return map; | |
| 1648 | + } | |
| 1649 | + @Override | |
| 1650 | + public List<StationRoute> queryStrinon(String line, int zd) { | |
| 1651 | + // TODO Auto-generated method stub | |
| 1652 | + List<StationRoute> listStation= stationRouteRepository.findByLine(line,zd); | |
| 1653 | + return listStation; | |
| 1654 | + } | |
| 1472 | 1655 | } | ... | ... |
src/main/java/com/bsth/service/schedule/impl/TTInfoDetailServiceImpl.java
| ... | ... | @@ -374,16 +374,16 @@ public class TTInfoDetailServiceImpl extends BServiceImpl<TTInfoDetail, Long> im |
| 374 | 374 | } |
| 375 | 375 | |
| 376 | 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 | 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 | 382 | editInfo.getContents().add(fcInfos); |
| 383 | 383 | } |
| 384 | 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 | 389 | LOGGER.info("//---------------- 时刻表编辑用数据输出 success... ----------------//"); | ... | ... |
src/main/resources/datatools/ktrs/ttinfodetailDataOutputMetaData.ktr
| ... | ... | @@ -90,11 +90,11 @@ |
| 90 | 90 | </info> |
| 91 | 91 | <notepads> |
| 92 | 92 | <notepad> |
| 93 | - <note>这里有些问题
在window2012的环境下,
MySql数据库查询中如果返回中文内容的字段,这个内容乱码
解决办法,就是数据库查询全部缓存,就不乱码
linux环境下没问题</note> | |
| 94 | - <xloc>165</xloc> | |
| 95 | - <yloc>402</yloc> | |
| 96 | - <width>333</width> | |
| 97 | - <heigth>90</heigth> | |
| 93 | + <note>TODO:如果groupby 加入bctype,
则以发车顺序号,班次类型分组的数据可能重复,
应为班次类型可能不一样(导入之后人为修改的,如正常班次改成区间),
因为导出时必须数据不重复,这里的解决方法,只使用发车顺序号分组,
以后建议,还是原来的方式分组,然后把更新时间晚的去除

以后改成去除重复纪录</note> | |
| 94 | + <xloc>37</xloc> | |
| 95 | + <yloc>309</yloc> | |
| 96 | + <width>406</width> | |
| 97 | + <heigth>122</heigth> | |
| 98 | 98 | <fontname>YaHei Consolas Hybrid</fontname> |
| 99 | 99 | <fontsize>12</fontsize> |
| 100 | 100 | <fontbold>N</fontbold> |
| ... | ... | @@ -445,7 +445,7 @@ |
| 445 | 445 | <schema_name/> |
| 446 | 446 | </partitioning> |
| 447 | 447 | <connection>bus_control_variable</connection> |
| 448 | - <sql>select 
fcno
, min(xl_dir) xl_dir
,min(qdz) qdz
,min(zdz) zdz
,bc_type 
from bsth_c_s_ttinfo_detail
where ttinfo = ${ttinfoid}
group by fcno,bc_type</sql> | |
| 448 | + <sql>select 
fcno
, min(xl) xl 
, min(xl_dir) xl_dir
, min(qdz_code) qdz
, min(zdz_code) zdz
, min(bc_type) bc_type 
from bsth_c_s_ttinfo_detail
where ttinfo = ${ttinfoid}
group by fcno</sql> | |
| 449 | 449 | <limit>0</limit> |
| 450 | 450 | <lookup/> |
| 451 | 451 | <execute_each_row>N</execute_each_row> |
| ... | ... | @@ -481,8 +481,8 @@ |
| 481 | 481 | <fail_on_multiple>N</fail_on_multiple> |
| 482 | 482 | <eat_row_on_failure>N</eat_row_on_failure> |
| 483 | 483 | <key> |
| 484 | - <name>zd</name> | |
| 485 | - <field>station</field> | |
| 484 | + <name>xl</name> | |
| 485 | + <field>line</field> | |
| 486 | 486 | <condition>=</condition> |
| 487 | 487 | <name2/> |
| 488 | 488 | </key> |
| ... | ... | @@ -492,6 +492,12 @@ |
| 492 | 492 | <condition>=</condition> |
| 493 | 493 | <name2/> |
| 494 | 494 | </key> |
| 495 | + <key> | |
| 496 | + <name>zd</name> | |
| 497 | + <field>station_code</field> | |
| 498 | + <condition>=</condition> | |
| 499 | + <name2/> | |
| 500 | + </key> | |
| 495 | 501 | <value> |
| 496 | 502 | <name>station_name</name> |
| 497 | 503 | <rename>zdname</rename> |
| ... | ... | @@ -712,6 +718,29 @@ |
| 712 | 718 | </GUI> |
| 713 | 719 | </step> |
| 714 | 720 | |
| 721 | + <step> | |
| 722 | + <name>去除重复记录</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 | 744 | <step_error_handling> |
| 716 | 745 | </step_error_handling> |
| 717 | 746 | <slave-step-copy-partition-distribution> | ... | ... |