Commit c8001113cdd1a6b5d14c244ffed1c8f4601e23a1

Authored by 廖磊
2 parents 25a2b68d 9485a38e

Merge branch 'pudong' of http://222.66.0.204:8090/panzhaov5/bsth_control

into pudong
Showing 24 changed files with 448 additions and 240 deletions
src/main/java/com/bsth/XDApplication.java
... ... @@ -146,7 +146,7 @@ public class XDApplication implements CommandLineRunner {
146 146 sexec.scheduleWithFixedDelay(schedulePstThread, 120, 10, TimeUnit.SECONDS);//班次延迟入库线程
147 147 sexec.scheduleWithFixedDelay(seiPstThread, 160, 60, TimeUnit.SECONDS);//班次修正日志入库
148 148 sexec.scheduleWithFixedDelay(directivesPstThread, 180, 120, TimeUnit.SECONDS);//调度指令延迟入库
149   - //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
  149 + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
150 150 sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
151 151 sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新
152 152 sexec.scheduleWithFixedDelay(autoExecScanThread, 160, 50, TimeUnit.SECONDS);//班次自动执行
... ...
src/main/java/com/bsth/controller/LineVersionsController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.text.ParseException;
4   -import java.text.SimpleDateFormat;
5   -import java.util.Date;
6 3 import java.util.List;
7 4 import java.util.Map;
8 5  
... ... @@ -12,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 9 import org.springframework.web.bind.annotation.RequestParam;
13 10 import org.springframework.web.bind.annotation.RestController;
14 11  
15   -import com.bsth.entity.Line;
16 12 import com.bsth.entity.LineVersions;
17 13 import com.bsth.repository.LineRepository;
18 14 import com.bsth.service.LineVersionsService;
... ... @@ -80,4 +76,13 @@ public class LineVersionsController extends BaseController<LineVersions, Integer
80 76 return service.add(map);
81 77 }
82 78  
  79 + /**
  80 + * 根据线路id获取当前版本号
  81 + *
  82 + */
  83 + @RequestMapping(value = "findCurrentVersion", method = RequestMethod.GET)
  84 + public Integer findCurrentVersion(@RequestParam(defaultValue = "lineId") int lineId) {
  85 + return service.findCurrentVersion(lineId);
  86 + }
  87 +
83 88 }
... ...
src/main/java/com/bsth/data/ThreadMonotor.java
1 1 package com.bsth.data;
2 2  
3   -import org.slf4j.Logger;
4   -import org.slf4j.LoggerFactory;
  3 +import com.bsth.data.gpsdata_v2.DataHandleProcess;
  4 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
5 5 import org.springframework.stereotype.Component;
6 6  
7 7 /**
... ... @@ -10,32 +10,10 @@ import org.springframework.stereotype.Component;
10 10 @Component
11 11 public class ThreadMonotor extends Thread{
12 12  
13   - Logger log = LoggerFactory.getLogger(this.getClass());
14   -
15 13 @Override
16 14 public void run() {
17   -
18   - //线调GPS分析主线程
19   - /*if(GpsRealAnalyse.isBlock()){
20   - log.warn("GpsRealAnalyse isBlock true !!!!");
21   - GpsRealAnalyse.shutdown();
22   - }*/
23   -
24   - /*if(GpsRealAnalyse.isIdle()){
25   - //切换到备用的网关实时GPS对照数据
  15 + //切换到备用的网关实时GPS对照数据
  16 + if(DataHandleProcess.isBlock())
26 17 GpsDataLoaderThread.setFlag(-1);
27   - }*/
28   -
29   - //webSocket 消息推送队列
30   - /*if(WebSocketPushQueue.isIdle()){
31   - log.warn("WebSocketPushQueue isIdle true !!!!");
32   - WebSocketPushQueue.start();
33   - }*/
34   -
35   - //网关指令推送队列(系统自动发送的)
36   - /*if(DirectivePushQueue.isIdle()){
37   - log.warn("DirectivePushQueue isIdle true !!!!");
38   - DirectivePushQueue.start();
39   - }*/
40 18 }
41 19 }
42 20 \ No newline at end of file
... ...
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
... ... @@ -50,6 +50,9 @@ public class CarOutInfoHandler {
50 50  
51 51 Logger logger = LoggerFactory.getLogger(this.getClass());
52 52  
  53 +
  54 + ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
  55 + List<ScheduleRealInfo> pstList = new ArrayList<>();
53 56 /**
54 57 * 全量更新发车信息表
55 58 */
... ... @@ -57,24 +60,27 @@ public class CarOutInfoHandler {
57 60 try{
58 61 //将班次按线路分组
59 62 List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
60   - ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
61 63 for(ScheduleRealInfo sch : all){
62 64 xlMaps.put(sch.getXlBm(), sch);
63 65 }
64 66  
65 67 Set<String> ks = xlMaps.keySet();
66 68 for (String k : ks) {
67   - update(xlMaps.get(k));
  69 + pstList.addAll(update(xlMaps.get(k)));
68 70 }
  71 +
  72 + save(pstList);
  73 + pstList.clear();
  74 + xlMaps.clear();
  75 + logger.info("更新发车信息表!!");
69 76 }catch (Exception e){
70 77 logger.error("", e);
71 78 }
72 79 }
73 80  
74   - public void update(List<ScheduleRealInfo> list) {
  81 + public List<ScheduleRealInfo> update(List<ScheduleRealInfo> list) {
75 82 if (list.size() == 0)
76   - return;
77   - String lineCode = list.get(0).getXlBm();
  83 + return new ArrayList<>();
78 84 //按上下行分组
79 85 List<ScheduleRealInfo> ups = new ArrayList<>(), downs = new ArrayList<>();
80 86 for (ScheduleRealInfo sch : list) {
... ... @@ -87,7 +93,12 @@ public class CarOutInfoHandler {
87 93 ScheduleRealInfo[] upArray = nexts(ups),
88 94 downArray = nexts(downs);
89 95  
90   - final List<ScheduleRealInfo> pstArray = mergeArray(upArray, downArray);
  96 + List<ScheduleRealInfo> pstArray = mergeArray(upArray, downArray);
  97 +
  98 + return pstArray;
  99 + }
  100 +
  101 + private void save(final List<ScheduleRealInfo> pstList){
91 102 //编程式事务
92 103 DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
93 104 DefaultTransactionDefinition def = new DefaultTransactionDefinition();
... ... @@ -96,13 +107,13 @@ public class CarOutInfoHandler {
96 107  
97 108 try{
98 109 //删除
99   - jdbcTemplate.update("delete from bsth_t_clfcxxb where line_code=?", lineCode);
  110 + jdbcTemplate.update("delete from bsth_t_clfcxxb");
100 111 //重新写入
101 112 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)" +
102 113 " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
103 114 @Override
104 115 public void setValues(PreparedStatement ps, int i) throws SQLException {
105   - ScheduleRealInfo sch = pstArray.get(i);
  116 + ScheduleRealInfo sch = pstList.get(i);
106 117 ps.setString(1, sch.getScheduleDateStr());
107 118 ps.setString(2, sch.getXlBm());
108 119 ps.setString(3, sch.getXlName());
... ... @@ -122,7 +133,7 @@ public class CarOutInfoHandler {
122 133  
123 134 @Override
124 135 public int getBatchSize() {
125   - return pstArray.size();
  136 + return pstList.size();
126 137 }
127 138 });
128 139  
... ... @@ -159,8 +170,8 @@ public class CarOutInfoHandler {
159 170 ScheduleRealInfo[] array = new ScheduleRealInfo[3];
160 171 Collections.sort(list, schDFSJComparator);
161 172  
162   - int count = 0, threshold = 1000 * 60 * 60 * 4;
163   - long t = System.currentTimeMillis();
  173 + int count = 0;//, threshold = 1000 * 60 * 60 * 4;
  174 + //long t = System.currentTimeMillis();
164 175 for (ScheduleRealInfo sch : list) {
165 176 if (count == 3)
166 177 break;
... ... @@ -180,8 +191,8 @@ public class CarOutInfoHandler {
180 191 || StringUtils.isNotEmpty(sch.getZdsjActual()))
181 192 continue;
182 193  
183   - if (t - sch.getDfsjT() > threshold)
184   - continue;
  194 + /*if (t - sch.getDfsjT() > threshold)
  195 + continue;*/
185 196  
186 197 array[count] = sch;
187 198 count++;
... ...
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
... ... @@ -46,8 +46,17 @@ public class DataHandleProcess {
46 46 @Autowired
47 47 GpsRealData gpsRealData;
48 48  
  49 + static long lastTime;
  50 +
  51 + public static boolean isBlock() {
  52 + return System.currentTimeMillis() - lastTime > 1000 * 20;
  53 + }
  54 +
49 55 public void handle(List<GpsEntity> list) {
50 56 try {
  57 + if(list.size() == 0)
  58 + return;
  59 + lastTime = System.currentTimeMillis();
51 60 //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑)
52 61 ArrayListMultimap multimap = ArrayListMultimap.create();
53 62 for (GpsEntity gps : list) {
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/SignalSchPlanMatcher.java
... ... @@ -45,7 +45,8 @@ public class SignalSchPlanMatcher {
45 45  
46 46 if(null != near && !near.getId().equals(sch.getId())){
47 47  
48   - if(Math.abs(t - near.getDfsjT()) < Math.abs((t - sch.getDfsjT()))){
  48 + int nearDiff = (int) Math.abs(t - near.getDfsjT());
  49 + if(nearDiff < 1000 * 60 * 8 && nearDiff < Math.abs((t - sch.getDfsjT()))){
49 50  
50 51 dayOfSchedule.addExecPlan(near);
51 52 return false;
... ... @@ -57,47 +58,6 @@ public class SignalSchPlanMatcher {
57 58 log.error("", e);
58 59 }
59 60 return true;
60   - /*try{
61   - //会不会是分班没有完成
62   - if(sch.getBcType().equals("in") && t - sch.getDfsjT() > 1000 * 60 * 20){
63   - ScheduleRealInfo fbFirst = dayOfSchedule.nextByBcType(sch, "normal");
64   -
65   - if(fbFirst == null || !fbFirst.getQdzCode().equals(gps.getStopNo()))
66   - return;
67   -
68   - long dt = fbFirst.getDfsjT();
69   - //晚于待发前4分钟 -执行分班的首个营运
70   - if(dt - t < 1000 * 60 * 4){
71   - dayOfSchedule.addExecPlan(fbFirst);
72   - return;
73   - }
74   - }
75   -
76   - //线路编码不匹配
77   - if("out".equals(sch.getBcType()) && !sch.getXlBm().equals(gps.getLineId())){
78   - ScheduleRealInfo nextOut = dayOfSchedule.nextByBcType(sch, "out");
79   - if(nextOut != null && nextOut.getXlBm().equals(gps.getLineId())
80   - && fcSpace(sch, gps) > fcSpace(nextOut, gps)){
81   - dayOfSchedule.addExecPlan(nextOut);
82   - return;
83   - }
84   - }
85   - }catch (Exception e){
86   - log.error("", e);
87   - }
88   -
89   - //下一个相同走向的班次
90   - ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
91   - if(next == null || !next.getQdzCode().equals(sch.getQdzCode()))
92   - return;
93   -
94   - //晚于班次间隔百分之70,跳下一个班次
95   - double s = (int) (next.getDfsjT() - sch.getDfsjT());
96   - double r = (int) (t - sch.getDfsjT());
97   - if(r / s > 0.7){
98   - if(dayOfSchedule.addExecPlan(next))
99   - outMatch(gps, next);
100   - }*/
101 61 }
102 62  
103 63 /**
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -13,7 +13,6 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 13 import com.bsth.entity.schedule.SchedulePlanInfo;
14 14 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
15 15 import com.bsth.service.schedule.SchedulePlanInfoService;
16   -import com.bsth.util.BatchSaveUtils;
17 16 import com.bsth.websocket.handler.SendUtils;
18 17 import com.google.common.base.Predicate;
19 18 import com.google.common.collect.ArrayListMultimap;
... ... @@ -25,9 +24,16 @@ import org.slf4j.Logger;
25 24 import org.slf4j.LoggerFactory;
26 25 import org.springframework.beans.factory.annotation.Autowired;
27 26 import org.springframework.dao.DataIntegrityViolationException;
  27 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
28 28 import org.springframework.jdbc.core.JdbcTemplate;
  29 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
29 30 import org.springframework.stereotype.Component;
  31 +import org.springframework.transaction.TransactionDefinition;
  32 +import org.springframework.transaction.TransactionStatus;
  33 +import org.springframework.transaction.support.DefaultTransactionDefinition;
30 34  
  35 +import java.sql.PreparedStatement;
  36 +import java.sql.SQLException;
31 37 import java.text.ParseException;
32 38 import java.text.SimpleDateFormat;
33 39 import java.util.*;
... ... @@ -395,8 +401,83 @@ public class DayOfSchedule {
395 401 item.setScheduleDateStr(sdfyyyyMMdd.format(item.getScheduleDate()));
396 402 }
397 403  
  404 + //编程式事务
  405 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  406 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  407 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  408 + TransactionStatus status = tran.getTransaction(def);
  409 +
  410 + try{
  411 + final List<ScheduleRealInfo> pstList = list;
  412 + //写入
  413 + jdbcTemplate.batchUpdate("insert into bsth_c_s_sp_info_real(id,bc_type,bcs,bcsj,cl_zbh,create_date,dfsj,directive_state,fcno,fcsj,fcsj_actual,j_gh,j_name,jhlc,lp_name,qdz_code,qdz_name,real_exec_date,remarks,s_gh,s_name,schedule_date,schedule_date_str,sflj,sp_id,status,update_date,xl_bm,xl_dir,xl_name,zdsj,zdsj_actual,zdz_code,zdz_name,ccno,df_auto,fgs_bm,fgs_name,gs_bm,gs_name,online,adjust_exps,reissue,jhlc_orig,sigin_compate,drift_status,cc_service,major_station_name)" +
  414 + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  415 + @Override
  416 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  417 + ScheduleRealInfo sch = pstList.get(i);
  418 + ps.setLong(1, sch.getId());
  419 + ps.setString(2, sch.getBcType());
  420 + ps.setInt(3, sch.getBcs()==null?0:sch.getBcs());
  421 + ps.setInt(4, sch.getBcsj()==null?0:sch.getBcsj());
  422 + ps.setString(5, sch.getClZbh());
  423 + ps.setDate(6, new java.sql.Date(sch.getCreateDate().getTime()));
  424 + ps.setString(7, sch.getDfsj());
  425 + ps.setInt(8, sch.getDirectiveState());
  426 + ps.setInt(9, sch.getFcno()==null?0:sch.getFcno());
  427 + ps.setString(10, sch.getFcsj());
  428 + ps.setString(11, sch.getFcsjActual());
  429 + ps.setString(12, sch.getjGh());
  430 + ps.setString(13, sch.getjName());
  431 + ps.setDouble(14, sch.getJhlc());
  432 + ps.setString(15, sch.getLpName());
  433 + ps.setString(16, sch.getQdzCode());
  434 + ps.setString(17, sch.getQdzName());
  435 + ps.setString(18, sch.getRealExecDate());
  436 + ps.setString(19, sch.getRemarks());
  437 + ps.setString(20, sch.getsGh());
  438 + ps.setString(21, sch.getsName());
  439 + ps.setDate(22, new java.sql.Date(sch.getScheduleDate().getTime()));
  440 + ps.setString(23, sch.getScheduleDateStr());
  441 + ps.setBoolean(24, sch.isSflj());
  442 + ps.setLong(25, sch.getSpId());
  443 + ps.setInt(26, sch.getStatus());
  444 + ps.setDate(27, new java.sql.Date(sch.getUpdateDate().getTime()));
  445 + ps.setString(28, sch.getXlBm());
  446 + ps.setString(29, sch.getXlDir());
  447 + ps.setString(30, sch.getXlName());
  448 + ps.setString(31, sch.getZdsj());
  449 + ps.setString(32, sch.getZdsjActual());
  450 + ps.setString(33, sch.getZdzCode());
  451 + ps.setString(34, sch.getZdzName());
  452 + ps.setInt(35, sch.getCcno()==null?0:sch.getCcno());
  453 + ps.setBoolean(36, sch.isDfAuto());
  454 + ps.setString(37, sch.getFgsBm());
  455 + ps.setString(38, sch.getFgsName());
  456 + ps.setString(39, sch.getGsBm());
  457 + ps.setString(40, sch.getGsName());
  458 + ps.setBoolean(41, sch.isOnline());
  459 + ps.setString(42, sch.getAdjustExps());
  460 + ps.setBoolean(43, sch.isReissue());
  461 + ps.setDouble(44, sch.getJhlcOrig());
  462 + ps.setInt(45, sch.getSiginCompate());
  463 + ps.setInt(46, sch.getDriftStatus());
  464 + ps.setBoolean(47, sch.isCcService());
  465 + ps.setString(48, sch.getMajorStationName());
  466 + }
  467 +
  468 + @Override
  469 + public int getBatchSize() {
  470 + return pstList.size();
  471 + }
  472 + });
  473 +
  474 + tran.commit(status);
  475 + }catch (Exception e){
  476 + tran.rollback(status);
  477 + logger.error("real schedule batchSave error...", e);
  478 + }
398 479 // 入库
399   - new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class);
  480 + //new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class);
400 481 }
401 482  
402 483 public List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) {
... ... @@ -825,7 +906,7 @@ public class DayOfSchedule {
825 906 }
826 907  
827 908 public Collection<ScheduleRealInfo> findAll() {
828   - return nbbmScheduleMap.values();
  909 + return id2SchedulMap.values();
829 910 }
830 911  
831 912 public boolean addExecPlan(ScheduleRealInfo sch) {
... ... @@ -892,7 +973,7 @@ public class DayOfSchedule {
892 973 }
893 974  
894 975 public void reCalcExecPlan(String nbbm) {
895   - logger.info("reCalcExecPlan...: " + nbbm);
  976 + //logger.info("reCalcExecPlan...: " + nbbm);
896 977 List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm);
897 978 Collections.sort(list, schFCSJComparator);
898 979  
... ...
src/main/java/com/bsth/repository/LineVersionsRepository.java
... ... @@ -73,4 +73,10 @@ public interface LineVersionsRepository extends BaseRepository&lt;LineVersions, Int
73 73 @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1 and lv.versions = (?2 - "+1+")")
74 74 public LineVersions findBylineIdAndVersions(Integer id, Integer versions);
75 75  
  76 +
  77 + /**
  78 + * 获取线路版本的上一个版本
  79 + */
  80 + @Query(value = " SELECT lv.versions FROM LineVersions lv where lv.line.id = ?1 and lv.status=1")
  81 + public Integer findCurrentVersion(Integer id);
76 82 }
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -15,7 +15,6 @@ import org.springframework.transaction.annotation.Transactional;
15 15  
16 16 import com.bsth.entity.Line;
17 17 import com.bsth.entity.StationRoute;
18   -import com.bsth.entity.StationRouteCache;
19 18  
20 19 /**
21 20 *
... ... @@ -285,6 +284,17 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
285 284 "ORDER BY " +
286 285 "lineCode,directions,stationRouteCode")
287 286 List<Map<String, String>> findAllLineWithYgc();
  287 +
  288 + @Query("SELECT new map(" +
  289 + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," +
  290 + "line.linePlayType as linePlayType,s.stationMark as stationMark) " +
  291 + "FROM " +
  292 + "StationRoute s " +
  293 + "WHERE " +
  294 + "s.destroy = 0 and s.lineCode = ?1 " +
  295 + "ORDER BY " +
  296 + "lineCode,directions,stationRouteCode")
  297 + List<Map<String, String>> findLineWithYgcByLine(String lineCode);
288 298  
289 299 @Modifying
290 300 @Query(value="update bsth_c_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true)
... ...
src/main/java/com/bsth/service/LineVersionsService.java
... ... @@ -33,6 +33,9 @@ public interface LineVersionsService extends BaseService&lt;LineVersions, Integer&gt;
33 33 List<LineVersions> lineUpdate();
34 34  
35 35 LineVersions findLineVersionsMax(int lineId);
  36 +
  37 + // 返回当前线路版本
  38 + Integer findCurrentVersion(int lineId);
36 39  
37 40 Map<String, Object> add(Map<String, Object> map);
38 41  
... ...
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
... ... @@ -250,5 +250,13 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
250 250 }
251 251 return resultMap;
252 252 }
  253 +
  254 + /**
  255 + * 获取当前线路版本号
  256 + */
  257 + @Override
  258 + public Integer findCurrentVersion(int lineId) {
  259 + return repository.findCurrentVersion(lineId);
  260 + }
253 261  
254 262 }
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
... ... @@ -18,6 +18,7 @@ import com.alibaba.fastjson.JSONObject;
18 18 import com.bsth.common.ResponseCode;
19 19 import com.bsth.entity.Line;
20 20 import com.bsth.entity.LineInformation;
  21 +import com.bsth.entity.LineVersions;
21 22 import com.bsth.entity.Section;
22 23 import com.bsth.entity.SectionRoute;
23 24 import com.bsth.entity.SectionRouteCache;
... ... @@ -26,12 +27,14 @@ import com.bsth.entity.StationRoute;
26 27 import com.bsth.entity.StationRouteCache;
27 28 import com.bsth.repository.LineInformationRepository;
28 29 import com.bsth.repository.LineRepository;
  30 +import com.bsth.repository.LineVersionsRepository;
29 31 import com.bsth.repository.SectionRepository;
30 32 import com.bsth.repository.SectionRouteCacheRepository;
31 33 import com.bsth.repository.SectionRouteRepository;
32 34 import com.bsth.repository.StationRepository;
33 35 import com.bsth.repository.StationRouteCacheRepository;
34 36 import com.bsth.repository.StationRouteRepository;
  37 +import com.bsth.service.LineVersionsService;
35 38 import com.bsth.service.StationService;
36 39 import com.bsth.util.GetUIDAndCode;
37 40 import com.bsth.util.TransGPS;
... ... @@ -83,6 +86,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
83 86 @Autowired
84 87 private SectionRouteCacheRepository sectionRouteCacheRepository;
85 88  
  89 + @Autowired
  90 + LineVersionsRepository lineVersionsRepository;
  91 +
86 92 private GeoUtils geoUtils;
87 93  
88 94 Logger logger = LoggerFactory.getLogger(this.getClass());
... ... @@ -293,20 +299,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
293 299 Integer stationId = Integer.parseInt(isHaveMap.get("id").toString());
294 300 arg0 = repository.findOne(stationId);
295 301  
296   - if ((i==0 || i==stationsArray.size()-1) && resultLine.getLinePlayType() != 1) {// (起终点站)
297   - List<Station> list = new ArrayList<>();
298   - list.add(arg0);
299   - List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
300   - Station station = stationlist.get(0);
301   - // 站点编码
302   - long stationCode = GetUIDAndCode.getStationId();
303   - station.setStationCod(String.valueOf(stationCode));
304   - station.setId((int)stationCode);
305   - station.setCreateDate(null);
306   - station.setUpdateDate(null);
307   - repository.save(station);
308   - arg0 = station;
309   - } else if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  302 + if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  303 + arg0 = loopStartStation;
  304 + } else {
310 305 List<Station> list = new ArrayList<>();
311 306 list.add(arg0);
312 307 List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
... ... @@ -318,12 +313,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
318 313 station.setCreateDate(null);
319 314 station.setUpdateDate(null);
320 315 repository.save(station);
321   - arg0 = station;
322   - loopStartStation = arg0;
323   - repository.save(arg0);
324   - } else if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
325   - arg0 = loopStartStation;
326   - }
  316 + arg0 = station;
  317 + if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  318 + loopStartStation = arg0;
  319 + }
  320 + }
327 321 }else {
328 322 // 站点编码
329 323 long stationCode = GetUIDAndCode.getStationId();
... ... @@ -417,8 +411,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
417 411 // 中途站
418 412 route.setStationMark("Z");
419 413 }
420   - // 版本号
421   - route.setVersions(versions);
  414 + // 版本号(获取线路当前版本)
  415 + Integer version = lineVersionsRepository.findCurrentVersion(resultLine.getId());
  416 + route.setVersions(version);
422 417 // 站点ID
423 418 route.setStation(arg0);
424 419 // 方向
... ... @@ -782,68 +777,65 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
782 777 Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
783 778 // 说明
784 779 String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
785   - if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) {
786   - stationId = Integer.parseInt(isHaveMap.get("id").toString());
787   - }else {
788   - // 站点编码
789   - stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
790   - // 站点ID
791   - stationId = Integer.valueOf(stationCod);
792   - // 圆半径
793   - Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
794   - // 图形类型
795   - String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
796   - // 创建人
797   - Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
798   - // 修改人
799   - Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
800   - // 城建坐标经度
801   - Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
802   - // 城建坐标纬度
803   - Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
804   - // 道路编码
805   - String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
806   - // 原坐标类型
807   - String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
808   - // WGS经纬度
809   - Float gLonx = null;
810   - // WGS纬度
811   - Float gLaty = null;
812   - if(bJwpointsArray.length>0) {
813   - Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]);
814   - gLonx = (float)resultPoint.getLng();
815   - gLaty = (float)resultPoint.getLat();
816   - }
817   - // 多边形原坐标点集合
818   - String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
819   - // 多边形WGS坐标点集合
820   - String gPloygonGrid ="";
821   - if(!bPloygonGrid.equals("")) {
822   - String bPloygonGridArray[] = bPloygonGrid.split(",");
823   - int bLen_ = bPloygonGridArray.length;
824   - for(int b = 0 ;b<bLen_;b++) {
825   - String tempArray[]= bPloygonGridArray[b].split(" ");
826   - Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]);
827   - if(b==0) {
828   - gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
829   - }else {
830   - gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
831   - }
832   - }
  780 + // 站点编码
  781 + stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
  782 + // 站点ID
  783 + stationId = Integer.valueOf(stationCod);
  784 + // 圆半径
  785 + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
  786 + // 图形类型
  787 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  788 + // 创建人
  789 + Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
  790 + // 修改人
  791 + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
  792 + // 城建坐标经度
  793 + Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
  794 + // 城建坐标纬度
  795 + Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
  796 + // 道路编码
  797 + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
  798 + // 原坐标类型
  799 + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
  800 + // WGS经纬度
  801 + Float gLonx = null;
  802 + // WGS纬度
  803 + Float gLaty = null;
  804 + if(bJwpointsArray.length>0) {
  805 + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]);
  806 + gLonx = (float)resultPoint.getLng();
  807 + gLaty = (float)resultPoint.getLat();
  808 + }
  809 + // 多边形原坐标点集合
  810 + String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
  811 + // 多边形WGS坐标点集合
  812 + String gPloygonGrid ="";
  813 + if(!bPloygonGrid.equals("")) {
  814 + String bPloygonGridArray[] = bPloygonGrid.split(",");
  815 + int bLen_ = bPloygonGridArray.length;
  816 + for(int b = 0 ;b<bLen_;b++) {
  817 + String tempArray[]= bPloygonGridArray[b].split(" ");
  818 + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]);
  819 + if(b==0) {
  820 + gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
  821 + }else {
  822 + gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
  823 + }
833 824 }
834   - if(bPloygonGrid.equals(""))
835   - bPloygonGrid = null;
836   - else
837   - bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
838   - if(gPloygonGrid.equals(""))
839   - gPloygonGrid = null;
840   - else
841   - gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
842   - // 保存站点
843   - repository.stationSave(stationCod, zdmc, roadCoding, dbType, bJwpoints,
844   - gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
845   - shapesType, versions, descriptions, createBy, updateBy,stationId);
846 825 }
  826 + if(bPloygonGrid.equals(""))
  827 + bPloygonGrid = null;
  828 + else
  829 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  830 + if(gPloygonGrid.equals(""))
  831 + gPloygonGrid = null;
  832 + else
  833 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
  834 + // 保存站点
  835 + repository.stationSave(stationCod, zdmc, roadCoding, dbType, bJwpoints,
  836 + gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
  837 + shapesType, versions, descriptions, createBy, updateBy,stationId);
  838 +
847 839 Station station = repository.findOne(stationId);
848 840 StationRoute arg0 = new StationRoute();
849 841 // 距离
... ... @@ -1200,8 +1192,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1200 1192 sectionRoute.setLine(resultLine);
1201 1193 // 路段编码
1202 1194 sectionRoute.setSectionCode(sectionCode);
1203   - // 版本
1204   - sectionRoute.setVersions(versions);
  1195 + // 版本号(获取线路当前版本)
  1196 + Integer version = lineVersionsRepository.findCurrentVersion(resultLine.getId());
  1197 + sectionRoute.setVersions(version);
1205 1198 sectionRoute.setDestroy(destroy);
1206 1199 // 方向
1207 1200 sectionRoute.setDirections(directions);
... ... @@ -1229,8 +1222,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1229 1222 String libraryPointstr = s.getbJwpoints();
1230 1223 String points[] = libraryPointstr.toString().split(" ");
1231 1224 Point center = new Point(Double.parseDouble(points[0]), Double.parseDouble(points[1]));
1232   - // 在100m内认为是同一个站点
1233   - Circle circle = new Circle(center, 100);
  1225 + // 在40m内认为是同一个站点
  1226 + Circle circle = new Circle(center, 40);
1234 1227 // 匹配到了用数据库中的点替换
1235 1228 if (geoUtils.isPointInCircle(point, circle)) {
1236 1229 map.put("name", s.getStationName().toString());
... ... @@ -1372,20 +1365,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1372 1365 Integer stationId = Integer.parseInt(stationsArray.getJSONObject(i).get("id").toString());
1373 1366 arg0 = repository.findOne(stationId);
1374 1367  
1375   - if ((i==0 || i==stationsArray.size()-1) && resultLine.getLinePlayType() != 1) {// (起终点站)
1376   - List<Station> list = new ArrayList<>();
1377   - list.add(arg0);
1378   - List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
1379   - Station station = stationlist.get(0);
1380   - // 站点编码
1381   - long stationCode = GetUIDAndCode.getStationId();
1382   - station.setStationCod(String.valueOf(stationCode));
1383   - station.setId((int)stationCode);
1384   - station.setCreateDate(null);
1385   - station.setUpdateDate(null);
1386   - repository.save(station);
1387   - arg0 = station;
1388   - } else if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  1368 + if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  1369 + arg0 = loopStartStation;
  1370 + } else {
1389 1371 List<Station> list = new ArrayList<>();
1390 1372 list.add(arg0);
1391 1373 List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
... ... @@ -1397,12 +1379,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1397 1379 station.setCreateDate(null);
1398 1380 station.setUpdateDate(null);
1399 1381 repository.save(station);
1400   - arg0 = station;
1401   - loopStartStation = arg0;
1402   - repository.save(arg0);
1403   - } else if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
1404   - arg0 = loopStartStation;
1405   - }
  1382 + arg0 = station;
  1383 + if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  1384 + loopStartStation = arg0;
  1385 + }
  1386 + }
1406 1387 }else {
1407 1388 // 站点编码
1408 1389 long stationCode = GetUIDAndCode.getStationId();
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -200,13 +200,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
200 200  
201 201 // 先查上行
202 202 upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
  203 + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode());
203 204 int startId = 1;
204   - startId = packagStationXml(upStationsList, sBuffer, startId);
  205 + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap);
205 206 // 环线不查下行
206 207 if(line.getLinePlayType() != 1){
207 208 // 再查下行
208 209 downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
209   - packagStationXml(downStationsList, sBuffer, startId);
  210 + packagStationXml(downStationsList, sBuffer, startId,stationNumMap);
210 211 }
211 212 sBuffer.append("</StationList>");
212 213  
... ... @@ -223,6 +224,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
223 224 sBuffer.append("</LinePointList>");
224 225 sBuffer.append("</XL>");
225 226 sBuffer.append("</XLs>");
  227 + // 临时添加,后面删除
  228 + if(sBuffer.indexOf("<ZDXH>0</ZDXH>") != -1){
  229 + return "0";
  230 + }
226 231 // 调用上传方法
227 232 if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){
228 233 result = "success";
... ... @@ -240,6 +245,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{
240 245 }
241 246  
242 247 /**
  248 + * 加载运管处的站点及序号
  249 + * 上行从1开始,下行顺序续编
  250 + */
  251 + private Map<String, Integer> getStationName2YgcNumberMap (String lineCode){
  252 + Map<String, Integer> resultMap = new HashMap<>();
  253 + List<Map<String, String>> ygcLines = stationRouteRepository.findLineWithYgcByLine(lineCode);
  254 + if(ygcLines != null && ygcLines.size() > 0){
  255 + int size = ygcLines.size();
  256 + Map<String, String> tempMap ;
  257 + int num = 1;
  258 + String key;
  259 + for (int i = 0; i < size; i ++){
  260 + tempMap = ygcLines.get(i);
  261 + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions"))
  262 + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark");
  263 + resultMap.put(key,num++);
  264 + }
  265 + }
  266 + return resultMap;
  267 + }
  268 +
  269 + /**
243 270 * 上传线路信息(按in_use上传)
244 271 */
245 272 @Override
... ... @@ -431,7 +458,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
431 458 // 起点站的参数
432 459 otherMap.put("stationMark","B");
433 460 paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap);
434   - sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) + "</FCZDXH>");
  461 + sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) + "</FCZDXH>");
435 462 sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>");
436 463 sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>");
437 464 sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>");
... ... @@ -441,7 +468,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
441 468 // 终点站的参数
442 469 otherMap.put("stationMark","E");
443 470 paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap);
444   - sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) +"</DDZDXH>");
  471 + sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) +"</DDZDXH>");
445 472 sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>");
446 473 sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>");
447 474 sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>");
... ... @@ -768,13 +795,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{
768 795 // 起点站的参数
769 796 otherMap.put("stationMark","B");
770 797 paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap);
771   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>");
  798 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>");
772 799 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>");
773 800 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>");
774 801 // 起点站的参数
775 802 otherMap.put("stationMark","E");
776 803 paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap);
777   - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>");
  804 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>");
778 805 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj()))
779 806 .append("</JHDDSJ>");
780 807 sBuffer.append("</BC>");
... ... @@ -883,14 +910,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
883 910 // 起点站的参数
884 911 otherMap.put("stationMark","B");
885 912 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
886   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>");
  913 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>");
887 914 sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
888 915 sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
889 916 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>");
890 917 // 起点站的参数
891 918 otherMap.put("stationMark","E");
892 919 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
893   - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>");
  920 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>");
894 921 sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
895 922 sBuffer.append("</BC>");
896 923 }
... ... @@ -1214,7 +1241,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1214 1241 *
1215 1242 * @return 站点序号累加后的ID
1216 1243 */
1217   - private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){
  1244 + private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId,Map<String, Integer> stationNumMap){
1218 1245 int size = stationsList.size();
1219 1246 StationRoute srRoute;
1220 1247 HashMap<String,String> paraMap;
... ... @@ -1231,7 +1258,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1231 1258 }
1232 1259 paraMap = packageYgcStationNumParam(srRoute,null);
1233 1260 sBuffer.append("<Station>");
1234   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</ZDXH>");
  1261 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap,stationNumMap)).append("</ZDXH>");
1235 1262 sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>");
1236 1263 sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>");
1237 1264 sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>");
... ... @@ -1287,7 +1314,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1287 1314 * @param map
1288 1315 * @return 运管处站点序号
1289 1316 */
1290   - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map){
  1317 + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map,Map<String, Integer> stationNumMap){
1291 1318 // 线路编码
1292 1319 String lineCode = map.get("lineCode");
1293 1320 // 线路走向 0:上行 1:下行
... ... @@ -1305,9 +1332,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1305 1332 }else if(stationMark.equals("Z")){
1306 1333 marks= new String[]{"Z"};
1307 1334 }
  1335 + // 默认从缓存BasicData.stationName2YgcNumber
  1336 + Map<String, Integer> tempMap = BasicData.stationName2YgcNumber;
  1337 + // 如果传入的stationNumMap不为空,则不是缓存取,而从stationNumMap取
  1338 + if(stationNumMap != null){
  1339 + tempMap = stationNumMap;
  1340 + }
1308 1341 Integer number = null;
1309 1342 for (int i = 0 ;i < marks.length ; i ++){
1310   - number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]);
  1343 + number = tempMap.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]);
1311 1344 if(number != null){
1312 1345 break;
1313 1346 }
... ...
src/main/resources/fatso/start.js
... ... @@ -16,7 +16,7 @@ var platform = process.platform;
16 16 var iswin = platform=='win32';
17 17 var sp = platform=='win32'?'\\':'/';
18 18 //不参与的目录
19   -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil']
  19 +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil','base'+sp+'geo_data_edit']
20 20 ,ep = new EventProxy()
21 21 ,pName = 'bsth_control'
22 22 ,path = process.cwd()
... ...
src/main/resources/static/pages/base/geo_data_edit/main.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
  7 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  8 + <!-- flatpickr -->
  9 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.css">
  10 + <!-- tooltip css-->
  11 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.css" />
  12 + <link rel="stylesheet" href="/real_control_v2/css/pace.css" />
  13 + <style>
  14 + /* ^_^ baidu map hide logo */
  15 + .anchorBL, .anchorBL, .amap-logo, .amap-copyright {
  16 + display: none;
  17 + }
  18 +
  19 + html,body{
  20 + height: 100%;
  21 + }
  22 + .ct_page{
  23 + padding: 0;
  24 + height: 100%;
  25 + }
  26 +
  27 + div#map_wrap{
  28 + height: 100%;
  29 + }
  30 +
  31 + .main_left_panel{
  32 + position: absolute;
  33 + z-index: 999;
  34 + height: calc(100% - 20px);
  35 + width: 300px;
  36 + background: #fffffff5;
  37 + top: 7px;
  38 + left: 5px;
  39 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  40 + }
  41 + .main_lt_search_panel{
  42 + position: absolute;
  43 + z-index: 99;
  44 + top: 10px;
  45 + left: 330px;
  46 + background: #fffffff5;
  47 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  48 + }
  49 + .main_rt_tools_panel{
  50 + position: absolute;
  51 + z-index: 99;
  52 + top: 7px;
  53 + right: 7px;
  54 + background: #ffffff;
  55 + box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48);
  56 + padding: 0 12px;
  57 + text-align: center;
  58 + border-radius: 7px;
  59 + height: 28px;
  60 + }
  61 +
  62 + .main_rt_tools_panel>._icon{
  63 + margin: 0 9px;
  64 + }
  65 + .search_input{
  66 + width: 250px;
  67 + height: 42px;
  68 + }
  69 +
  70 + .search_input::placeholder{
  71 + color: grey;
  72 + font-size: 12px;
  73 + }
  74 + </style>
  75 +</head>
  76 +
  77 +<body>
  78 +<div class="ct_page" >
  79 + <div id="map_wrap">
  80 + </div>
  81 + <div class="main_left_panel">
  82 + <div class="_line_info">
  83 +
  84 + </div>
  85 + </div>
  86 + <div class="main_lt_search_panel">
  87 + <div class="uk-inline">
  88 + <span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span>
  89 + <input class="uk-input search_input" placeholder="搜索地图位置" type="text">
  90 + </div>
  91 + </div>
  92 + <div class="main_rt_tools_panel">
  93 + <a uk-icon="icon: info;ratio: .9" class="_icon"></a>
  94 + <a uk-icon="icon: expand;ratio: .9" class="_icon"></a>
  95 + </div>
  96 +</div>
  97 +<!-- 百度 -->
  98 +<script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
  99 +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
  100 +<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
  101 +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
  102 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  103 +<!-- EventProxy -->
  104 +<script src="/assets/js/eventproxy.js"></script>
  105 +<!-- art-template 模版引擎 -->
  106 +<script src="/assets/plugins/template.js"></script>
  107 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  108 +<!-- jquery.serializejson JSON序列化插件 -->
  109 +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
  110 +<!-- flatpickr -->
  111 +<script src="/real_control_v2/assets/plugins/flatpickr/flatpickr.min.js" ></script>
  112 +<script src="/real_control_v2/assets/plugins/flatpickr/l10n/zh.js" ></script>
  113 +<!-- qtip -->
  114 +<script src="/real_control_v2/assets/plugins/qtip/jquery.qtip.min.js" ></script>
  115 +<script>
  116 + top.document.title = "绘制线路";
  117 + // 关闭左侧栏
  118 + if (!top.$('body').hasClass('page-sidebar-closed')) {top.$('.menu-toggler.sidebar-toggler').click();}
  119 +
  120 + //初始化地图
  121 + if(!window.BMap){
  122 + alert('地图没有加载成功,请确认是否能正常连接外网!!');
  123 + }
  124 + var gb_map_consts = {
  125 + mapContainer: '#map_wrap',
  126 + center_point: {
  127 + lng: 121.544336,
  128 + lat: 31.221315
  129 + }
  130 + };
  131 +
  132 + map = new BMap.Map($(gb_map_consts.mapContainer)[0]);
  133 + //map.setMapStyle({style:'dark'});
  134 + //中心点和缩放级别
  135 + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 13);
  136 + map.enableScrollWheelZoom();
  137 +</script>
  138 +</body>
  139 +</html>
0 140 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/uk3_wrap.html 0 → 100644
  1 +<iframe src="/pages/base/geo_data_edit/main.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe>
0 2 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/css/bmap_base.css
... ... @@ -190,12 +190,10 @@ ul li a:hover:not(.active) {
190 190 .radio_label {
191 191 display:block;
192 192 color: white;
193   - float: left;
194 193 cursor: pointer;
195 194 margin-left: 50px;
196 195 font-size: 20px;
197 196 margin-top: 5px;
198   - text-align: center;
199 197 }
200 198 .radioclass {
201 199 margin-top: 6px !important;
... ... @@ -207,7 +205,4 @@ ul li a:hover:not(.active) {
207 205 }
208 206 .on {
209 207 background-position: 0 0;
210   -}
211   -
212   -
213   -
  208 +}
214 209 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/map.html
... ... @@ -196,12 +196,12 @@ $(function(){
196 196 params.lineId=line.id;
197 197 params.dir = line.dir;
198 198 $.get('/stationroute/findCachePoint',params,function(data){
199   - var station_radio_html = '<div id="station_radio">';
  199 + var station_radio_html = '<div id="station_radio" >';
200 200 var cont = 1;
201 201 var check = 'checked="checked"';
202 202 $.each(data,function(){
203 203 stationRouteMap[this.stationRouteId] = this;
204   - station_radio_html += '<div class="radio"><label class="radio_label on"><input name="stationRadio" type="radio" class="radioclass" value="'+this.stationRouteId+'" '+(cont==1?check:"")+' />'+this.stationRouteStationName+"</label></div>";
  204 + station_radio_html += '<div class="radio" ><label class="radio_label on"><input name="stationRadio" type="radio" class="radioclass" value="'+this.stationRouteId+'" '+(cont==1?check:"")+' />'+this.stationRouteStationName+"</label></div>";
205 205 cont++;
206 206 });
207 207 station_radio_html += '</div>';
... ...
src/main/resources/static/pages/base/section/js/add-form-events.js
... ... @@ -22,12 +22,8 @@ $(function(){
22 22 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
23 23 $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
24 24 // 版本号赋值
25   - $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
26   - $.each(lineVersions,function(){
27   - if (this.status == 1) {
28   - $('#versionsInput').val(this.versions);
29   - }
30   - })
  25 + $.get('/lineVersions/findCurrentVersion',{'lineId':lineSelectValueArray[0]},function(versions){
  26 + $('#versionsInput').val(versions);
31 27 });
32 28 // 获取该线路下的路段路由.
33 29 PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) {
... ...
src/main/resources/static/pages/base/station/js/add-form-events.js
... ... @@ -24,12 +24,8 @@ $(function(){
24 24 $('#lineCodeInput').val(lineSelectValueArray[1]);
25 25 var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir};
26 26 // 版本号赋值
27   - $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
28   - $.each(lineVersions,function(){
29   - if (this.status == 1) {
30   - $('#versionsInput').val(this.versions);
31   - }
32   - })
  27 + $.get('/lineVersions/findCurrentVersion',{'lineId':lineSelectValueArray[0]},function(versions){
  28 + $('#versionsInput').val(versions);
33 29 });
34 30 initSelect(params);
35 31 }
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -237,12 +237,8 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
237 237 // 是否撤销
238 238 $('#destroySelect').val(0);
239 239 // 版本号
240   - $.get('/lineVersions/findByLineId',{'lineId':Line.id},function(lineVersions){
241   - $.each(lineVersions,function(){
242   - if (this.status == 1) {
243   - $('#versionsInput').val(this.versions);
244   - }
245   - })
  240 + $.get('/lineVersions/findCurrentVersion',{'lineId':Line.id},function(versions){
  241 + $('#versionsInput').val(versions);
246 242 });
247 243  
248 244 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir};
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
... ... @@ -216,7 +216,6 @@ var WorldsBMap = function () {
216 216  
217 217 // 地图画多边形
218 218 pointsPolygon : function(objStation) {
219   - debugger
220 219  
221 220 // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
222 221 mapBValue.setZoom(15);
... ... @@ -374,7 +373,6 @@ var WorldsBMap = function () {
374 373  
375 374 // 画圆
376 375 pointsCircle : function(objStation) {
377   - debugger
378 376  
379 377 // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
380 378 mapBValue.setZoom(16);
... ...
src/main/resources/static/pages/trafficManage/js/lineStationUpload.js
... ... @@ -111,6 +111,8 @@
111 111 success:function(data) {
112 112 if(data == 'success'){
113 113 alert("上传成功");
  114 + }else if(data == '0'){
  115 + alert("上传失败,线路编号有0");
114 116 }else{
115 117 alert("上传失败");
116 118 }
... ...
src/main/resources/static/pages/trafficManage/js/lineStationUploadRecord.js
... ... @@ -31,7 +31,7 @@
31 31  
32 32 initLineSelect2();
33 33  
34   - function initLineSelect2(compD) {debugger;
  34 + function initLineSelect2(compD) {
35 35 getComp(function(rs) {
36 36 var params = {};
37 37 if(rs.length>0) {
... ... @@ -55,7 +55,7 @@
55 55 if(len_>0) {
56 56 $.each(array, function(i, g){
57 57 if(g.name!='' || g.name != null) {
58   - paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name});
  58 + paramsD.push({'id':g.id ,'text':g.name});
59 59 }
60 60 });
61 61 initPinYinSelect2($('#line'),paramsD,function(selector) {
... ...