Commit 26d3239bc9d9f0b972a5b6406168d630957eef09

Authored by 廖磊
2 parents a7da449c 73d9e104

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

into pudong
Showing 53 changed files with 2566 additions and 189 deletions
src/main/java/com/bsth/XDApplication.java
1 1 package com.bsth;
2 2  
3 3 import com.bsth.data.BasicData;
4   -import com.bsth.data.LineVersionsData;
5 4 import com.bsth.data.ThreadMonotor;
6 5 import com.bsth.data.car_out_info.UpdateDBThread;
7 6 import com.bsth.data.directive.DirectivesPstThread;
8 7 import com.bsth.data.forecast.SampleTimeDataLoader;
9 8 import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
10 9 import com.bsth.data.gpsdata_v2.thread.OfflineMonitorThread;
  10 +import com.bsth.data.line_version.thread.FixedEnableVerionsThread;
11 11 import com.bsth.data.msg_queue.DirectivePushQueue;
12 12 import com.bsth.data.msg_queue.WebSocketPushQueue;
13 13 import com.bsth.data.safe_driv.SafeDrivDataLoadThread;
... ... @@ -73,8 +73,11 @@ public class XDApplication implements CommandLineRunner {
73 73 @Autowired
74 74 OfflineMonitorThread offlineMonitorThread;
75 75  
  76 + //@Autowired
  77 + //LineVersionsData lineVersionsData;
  78 +
76 79 @Autowired
77   - LineVersionsData lineVersionsData;
  80 + FixedEnableVerionsThread fixedEnableVerionsThread;
78 81  
79 82 @Autowired
80 83 SafeDrivDataLoadThread safeDrivDataLoadThread;
... ... @@ -126,7 +129,7 @@ public class XDApplication implements CommandLineRunner {
126 129 //实际排班更新线程
127 130 //sexec.scheduleWithFixedDelay(scheduleRefreshThread, 15, 240, TimeUnit.SECONDS);
128 131 //sexec.scheduleWithFixedDelay(autoExecScanThread, 100, 50, TimeUnit.SECONDS);//班次自动执行
129   - WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
  132 + //WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
130 133 //实际排班延迟入库线程
131 134 //sexec.scheduleWithFixedDelay(schedulePstThread, 60, 15, TimeUnit.SECONDS);
132 135 //班次修正日志延迟入库
... ... @@ -138,6 +141,8 @@ public class XDApplication implements CommandLineRunner {
138 141  
139 142 //安全驾驶
140 143 //sexec.scheduleWithFixedDelay(safeDrivDataLoadThread, 40, 30, TimeUnit.SECONDS);
  144 +
  145 + //sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 20, 60 * 2 , TimeUnit.SECONDS);
141 146 }
142 147  
143 148 public void prodInit(){
... ... @@ -175,6 +180,9 @@ public class XDApplication implements CommandLineRunner {
175 180 sexec.scheduleAtFixedRate(calcOilThread, timeDiff / 1000, 60 * 60 * 24, TimeUnit.SECONDS);
176 181  
177 182 //线路版本更新
178   - sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
  183 + //sexec.scheduleWithFixedDelay(lineVersionsData, 60 * 5, 60 * 15, TimeUnit.SECONDS);
  184 +
  185 + //线路版本更新
  186 + sexec.scheduleWithFixedDelay(fixedEnableVerionsThread, 60 * 4, 60 * 2 , TimeUnit.SECONDS);
179 187 }
180 188 }
... ...
src/main/java/com/bsth/controller/geo_data/GeoDataController.java
... ... @@ -22,14 +22,14 @@ public class GeoDataController {
22 22 GeoDataService geoDataService;
23 23  
24 24 @RequestMapping("findGeoStations")
25   - public Map<String, Object> findGeoStations(@RequestParam String lineCode){
26   - return geoDataService.findGeoStations(lineCode);
  25 + public Map<String, Object> findGeoStations(@RequestParam String lineCode, Integer version){
  26 + return geoDataService.findGeoStations(lineCode, version);
27 27 }
28 28  
29 29  
30 30 @RequestMapping("findGeoRoad")
31   - public Map<String, Object> findGeoRoad(@RequestParam String lineCode){
32   - return geoDataService.findGeoRoad(lineCode);
  31 + public Map<String, Object> findGeoRoad(@RequestParam String lineCode,Integer version){
  32 + return geoDataService.findGeoRoad(lineCode, version);
33 33 }
34 34  
35 35 @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST)
... ... @@ -73,4 +73,24 @@ public class GeoDataController {
73 73 public Map<String, Object> findVersionInfo(@RequestParam String lineCode){
74 74 return geoDataService.findVersionInfo(lineCode);
75 75 }
  76 +
  77 + @RequestMapping(value = "addNewLineVersion",method = RequestMethod.POST)
  78 + public Map<String, Object> addNewLineVersion(@RequestParam Map<String, Object> map){
  79 + return geoDataService.addNewLineVersion(map);
  80 + }
  81 +
  82 + @RequestMapping(value = "deleteLineVersion",method = RequestMethod.POST)
  83 + public Map<String, Object> deleteLineVersion(@RequestParam String lineCode,@RequestParam int version){
  84 + return geoDataService.deleteLineVersion(lineCode, version);
  85 + }
  86 +
  87 + @RequestMapping("findFutureVersion")
  88 + public Map<String, Object> findFutureVersion(@RequestParam String lineCode){
  89 + return geoDataService.findFutureVersion(lineCode);
  90 + }
  91 +
  92 + @RequestMapping(value = "addEnableInfo",method = RequestMethod.POST)
  93 + public Map<String, Object> addEnableInfo(@RequestParam String lineCode,@RequestParam int versions, @RequestParam String startDate){
  94 + return geoDataService.addEnableInfo(lineCode, versions, startDate);
  95 + }
76 96 }
77 97 \ No newline at end of file
... ...
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
... ... @@ -45,7 +45,7 @@ public class CarOutInfoHandler {
45 45 bcTypeMap.put("ldks", "两点间空驶");
46 46 }
47 47  
48   - private static ScheduleComparator.DFSJ schDFSJComparator = new ScheduleComparator.DFSJ();
  48 + private static ScheduleComparator.DFSJ2 schDFSJComparator = new ScheduleComparator.DFSJ2();
49 49  
50 50 @Autowired
51 51 JdbcTemplate jdbcTemplate;
... ...
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
... ... @@ -75,36 +75,13 @@ public class DataHandleProcess {
75 75  
76 76 List<Future> fRs = new ArrayList<>(ks.size());
77 77 for (Integer index : ks) {
78   - fRs.add(threadPool.submit(new SignalHandleThread(dataListMap.get(index), count)));
  78 + threadPool.submit(new SignalHandleThread(dataListMap.get(index), count));
79 79 }
80 80  
81   - //按线路分组gps
82   - /*ArrayListMultimap multimap = ArrayListMultimap.create();
83   - for (GpsEntity gps : list) {
84   - multimap.put(gps.getLineId(), gps);
85   - }
86   -
87   - Set<String> ks = multimap.keySet();
88   -
89   - logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
90   - count = new CountDownLatch(ks.size());
91   -
92   - for (String lineCode : ks) {
93   - threadPool.execute(new SignalHandleThread(multimap.get(lineCode), count));
94   - }*/
95 81  
96 82 //等待子线程结束
97 83 count.await();
98 84  
99   - for (Future f : fRs) {
100   - try {
101   - f.get();
102   - } catch (InterruptedException e) {
103   - } catch (ExecutionException e) {
104   - logger.error(e.getCause().getMessage());
105   - }
106   - }
107   -
108 85 //加入实时gps对照
109 86 for (GpsEntity gps : list)
110 87 gpsRealData.put(gps);
... ...
src/main/java/com/bsth/data/line_version/EnableRouteVersionHandler.java 0 → 100644
  1 +package com.bsth.data.line_version;
  2 +
  3 +import com.bsth.data.line_version.dto.EvSectionRoute;
  4 +import com.bsth.data.line_version.dto.EvStationRoute;
  5 +import org.slf4j.Logger;
  6 +import org.slf4j.LoggerFactory;
  7 +import org.springframework.beans.factory.annotation.Autowired;
  8 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  9 +import org.springframework.jdbc.core.JdbcTemplate;
  10 +import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
  11 +import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
  12 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  13 +import org.springframework.stereotype.Component;
  14 +import org.springframework.transaction.TransactionDefinition;
  15 +import org.springframework.transaction.TransactionStatus;
  16 +import org.springframework.transaction.support.DefaultTransactionDefinition;
  17 +
  18 +import java.util.ArrayList;
  19 +import java.util.List;
  20 +
  21 +/**
  22 + * 启用线路路由版本
  23 + * Created by panzhao on 2017/12/28.
  24 + */
  25 +@Component
  26 +public class EnableRouteVersionHandler {
  27 +
  28 + @Autowired
  29 + JdbcTemplate jdbcTemplate;
  30 +
  31 + @Autowired
  32 + NamedParameterJdbcTemplate namedParameterJdbcTemplate;
  33 +
  34 + Logger logger = LoggerFactory.getLogger(this.getClass());
  35 +
  36 + public void enable(String lineCode, int version){
  37 + //编程式事务
  38 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  39 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  40 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  41 + TransactionStatus status = tran.getTransaction(def);
  42 +
  43 +
  44 + try{
  45 + enableStation(lineCode, version);
  46 + enableRoad(lineCode, version);
  47 +
  48 + //将当前版本变为历史版本
  49 + String sql = "update bsth_c_line_versions set status=0, end_date=SYSDATE(),update_date=SYSDATE() where line_code=" + lineCode + " and status=1";
  50 + jdbcTemplate.update(sql);
  51 + //将待更新版本变为启用版本
  52 + sql = "update bsth_c_line_versions set status=1,update_date=SYSDATE() where line_code=" + lineCode + " and versions="+version;
  53 + jdbcTemplate.update(sql);
  54 +
  55 + tran.commit(status);
  56 + }catch (Exception e){
  57 + tran.rollback(status);
  58 + logger.error("", e);
  59 + }
  60 + }
  61 +
  62 + /**
  63 + * 启用新版本站点
  64 + * @param lineCode
  65 + * @param version
  66 + */
  67 + public void enableStation(String lineCode, int version){
  68 + //删除当前站点路由表数据
  69 + String sql = "delete from bsth_c_stationroute where line_code=" + lineCode;
  70 + jdbcTemplate.update(sql);
  71 +
  72 + //将新版本数据插入当前表
  73 + sql = "select * from bsth_c_ls_stationroute where line_code=" + lineCode + " and versions=" + version;
  74 + List<EvStationRoute> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(EvStationRoute.class));
  75 +
  76 + List<BeanPropertySqlParameterSource> sourceList = new ArrayList<>();
  77 + for(EvStationRoute s : list){
  78 + sourceList.add(new BeanPropertySqlParameterSource(s));
  79 + }
  80 +
  81 + sql = "insert into bsth_c_stationroute(id,line,station,station_name,station_route_code,line_code,station_code,station_mark,out_station_nmber,directions,distances,to_time,first_time,end_time,descriptions,destroy,versions,create_date,update_date) " +
  82 + " values(:id,:line,:station,:stationName,:stationRouteCode,:lineCode,:stationCode,:stationMark,:outStationNmber,:directions,:distances,:toTime,:firstTime,:endTime,:descriptions,:destroy,:versions,SYSDATE(),SYSDATE())";
  83 + BeanPropertySqlParameterSource[] beanSources = sourceList.toArray(new BeanPropertySqlParameterSource[sourceList.size()]);
  84 + namedParameterJdbcTemplate.batchUpdate(sql, beanSources);
  85 + }
  86 +
  87 + /**
  88 + * 启用新版本路段
  89 + * @param lineCode
  90 + * @param version
  91 + */
  92 + public void enableRoad(String lineCode, int version){
  93 + //删除当前路段路由表数据
  94 + String sql = "delete from bsth_c_sectionroute where line_code=" + lineCode;
  95 + jdbcTemplate.update(sql);
  96 +
  97 + //将新版本数据插入当前表
  98 + sql = "select * from bsth_c_ls_sectionroute where line_code=" + lineCode + " and versions=" + version;
  99 + List<EvSectionRoute> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(EvSectionRoute.class));
  100 +
  101 + List<BeanPropertySqlParameterSource> sourceList = new ArrayList<>();
  102 + for(EvSectionRoute s : list){
  103 + sourceList.add(new BeanPropertySqlParameterSource(s));
  104 + }
  105 +
  106 + sql = "insert into bsth_c_sectionroute(id,line_code,section_code,sectionroute_code,directions,line,section,descriptions,create_by,create_date,update_by,update_date,versions,destroy,is_roade_speed) " +
  107 + " values(:id,:lineCode,:sectionCode,:sectionrouteCode,:directions,:line,:section,:descriptions,:createBy,SYSDATE(),:updateBy,SYSDATE(),:versions,:destroy,:isRoadeSpeed)";
  108 + BeanPropertySqlParameterSource[] beanSources = sourceList.toArray(new BeanPropertySqlParameterSource[sourceList.size()]);
  109 + namedParameterJdbcTemplate.batchUpdate(sql, beanSources);
  110 + }
  111 +}
... ...
src/main/java/com/bsth/data/line_version/dto/EvSectionRoute.java 0 → 100644
  1 +package com.bsth.data.line_version.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/12/28.
  7 + */
  8 +public class EvSectionRoute {
  9 +
  10 +
  11 + private Integer id;
  12 +
  13 + // 路段路由序号
  14 + private Integer sectionrouteCode;
  15 +
  16 + // 线路编号
  17 + private String lineCode;
  18 +
  19 + // 路段编号
  20 + private String sectionCode;
  21 +
  22 + // 路段路由方向
  23 + private Integer directions;
  24 +
  25 + // 版本号
  26 + private Integer versions;
  27 +
  28 + // 是否撤销
  29 + private Integer destroy;
  30 +
  31 + /** 是否有路段限速数据 <0:分段;1:未分段>*/
  32 + private Integer isRoadeSpeed;
  33 +
  34 + // 描述
  35 + private String descriptions;
  36 +
  37 + // 创建人
  38 + private Integer createBy;
  39 +
  40 + // 修改人
  41 + private Integer updateBy;
  42 +
  43 + // 创建日期
  44 + private Date createDate;
  45 +
  46 + // 修改日期
  47 + private Date updateDate;
  48 +
  49 + // 路段信息
  50 + private Integer section;
  51 +
  52 + // 线路信息
  53 + private Integer line;
  54 +
  55 + public Integer getId() {
  56 + return id;
  57 + }
  58 +
  59 + public void setId(Integer id) {
  60 + this.id = id;
  61 + }
  62 +
  63 + public Integer getSectionrouteCode() {
  64 + return sectionrouteCode;
  65 + }
  66 +
  67 + public void setSectionrouteCode(Integer sectionrouteCode) {
  68 + this.sectionrouteCode = sectionrouteCode;
  69 + }
  70 +
  71 + public String getLineCode() {
  72 + return lineCode;
  73 + }
  74 +
  75 + public void setLineCode(String lineCode) {
  76 + this.lineCode = lineCode;
  77 + }
  78 +
  79 + public String getSectionCode() {
  80 + return sectionCode;
  81 + }
  82 +
  83 + public void setSectionCode(String sectionCode) {
  84 + this.sectionCode = sectionCode;
  85 + }
  86 +
  87 + public Integer getDirections() {
  88 + return directions;
  89 + }
  90 +
  91 + public void setDirections(Integer directions) {
  92 + this.directions = directions;
  93 + }
  94 +
  95 + public Integer getVersions() {
  96 + return versions;
  97 + }
  98 +
  99 + public void setVersions(Integer versions) {
  100 + this.versions = versions;
  101 + }
  102 +
  103 + public Integer getDestroy() {
  104 + return destroy;
  105 + }
  106 +
  107 + public void setDestroy(Integer destroy) {
  108 + this.destroy = destroy;
  109 + }
  110 +
  111 + public Integer getIsRoadeSpeed() {
  112 + return isRoadeSpeed;
  113 + }
  114 +
  115 + public void setIsRoadeSpeed(Integer isRoadeSpeed) {
  116 + this.isRoadeSpeed = isRoadeSpeed;
  117 + }
  118 +
  119 + public String getDescriptions() {
  120 + return descriptions;
  121 + }
  122 +
  123 + public void setDescriptions(String descriptions) {
  124 + this.descriptions = descriptions;
  125 + }
  126 +
  127 + public Integer getCreateBy() {
  128 + return createBy;
  129 + }
  130 +
  131 + public void setCreateBy(Integer createBy) {
  132 + this.createBy = createBy;
  133 + }
  134 +
  135 + public Integer getUpdateBy() {
  136 + return updateBy;
  137 + }
  138 +
  139 + public void setUpdateBy(Integer updateBy) {
  140 + this.updateBy = updateBy;
  141 + }
  142 +
  143 + public Date getCreateDate() {
  144 + return createDate;
  145 + }
  146 +
  147 + public void setCreateDate(Date createDate) {
  148 + this.createDate = createDate;
  149 + }
  150 +
  151 + public Date getUpdateDate() {
  152 + return updateDate;
  153 + }
  154 +
  155 + public void setUpdateDate(Date updateDate) {
  156 + this.updateDate = updateDate;
  157 + }
  158 +
  159 + public Integer getSection() {
  160 + return section;
  161 + }
  162 +
  163 + public void setSection(Integer section) {
  164 + this.section = section;
  165 + }
  166 +
  167 + public Integer getLine() {
  168 + return line;
  169 + }
  170 +
  171 + public void setLine(Integer line) {
  172 + this.line = line;
  173 + }
  174 +}
... ...
src/main/java/com/bsth/data/line_version/dto/EvStationRoute.java 0 → 100644
  1 +package com.bsth.data.line_version.dto;
  2 +
  3 +import java.util.Date;
  4 +
  5 +/**
  6 + * Created by panzhao on 2017/12/28.
  7 + */
  8 +public class EvStationRoute {
  9 + private Integer id;
  10 +
  11 + // 站点路由序号
  12 + private Integer stationRouteCode;
  13 +
  14 + // 站点编码
  15 + private String stationCode;
  16 +
  17 + // 站点名称
  18 + private String stationName;
  19 +
  20 + // 线路编码
  21 + private String lineCode;
  22 +
  23 + /**
  24 + * 站点类型
  25 + *
  26 + * ------ B:起点站
  27 + *
  28 + * ------ Z:中途站
  29 + *
  30 + * ------ E:终点站
  31 + *
  32 + * ------ T:停车场
  33 + *
  34 + */
  35 + private String stationMark;
  36 +
  37 + // 站点路由出站序号
  38 + private Integer outStationNmber;
  39 +
  40 + // 站点路由到站距离
  41 + private Double distances;
  42 +
  43 + // 站点路由到站时间
  44 + private Double toTime;
  45 +
  46 + // 首班时间
  47 + private String firstTime;
  48 +
  49 + // 末班时间
  50 + private String endTime;
  51 +
  52 + // 站点路由方向
  53 + private Integer directions;
  54 +
  55 + // 版本号
  56 + private Integer versions;
  57 +
  58 + // 是否撤销
  59 + private Integer destroy;
  60 +
  61 + // 描述
  62 + private String descriptions;
  63 +
  64 + // 创建人
  65 + private Integer createBy;
  66 +
  67 + // 修改人
  68 + private Integer updateBy;
  69 +
  70 + // 创建日期
  71 + private Date createDate;
  72 +
  73 + // 修改日期
  74 + private Date updateDate;
  75 +
  76 + // 站点信息
  77 + private Integer station;
  78 +
  79 + // 线路信息
  80 + private Integer line;
  81 +
  82 + public Integer getId() {
  83 + return id;
  84 + }
  85 +
  86 + public void setId(Integer id) {
  87 + this.id = id;
  88 + }
  89 +
  90 + public Integer getStationRouteCode() {
  91 + return stationRouteCode;
  92 + }
  93 +
  94 + public void setStationRouteCode(Integer stationRouteCode) {
  95 + this.stationRouteCode = stationRouteCode;
  96 + }
  97 +
  98 + public String getStationCode() {
  99 + return stationCode;
  100 + }
  101 +
  102 + public void setStationCode(String stationCode) {
  103 + this.stationCode = stationCode;
  104 + }
  105 +
  106 + public String getStationName() {
  107 + return stationName;
  108 + }
  109 +
  110 + public void setStationName(String stationName) {
  111 + this.stationName = stationName;
  112 + }
  113 +
  114 + public String getLineCode() {
  115 + return lineCode;
  116 + }
  117 +
  118 + public void setLineCode(String lineCode) {
  119 + this.lineCode = lineCode;
  120 + }
  121 +
  122 + public String getStationMark() {
  123 + return stationMark;
  124 + }
  125 +
  126 + public void setStationMark(String stationMark) {
  127 + this.stationMark = stationMark;
  128 + }
  129 +
  130 + public Integer getOutStationNmber() {
  131 + return outStationNmber;
  132 + }
  133 +
  134 + public void setOutStationNmber(Integer outStationNmber) {
  135 + this.outStationNmber = outStationNmber;
  136 + }
  137 +
  138 + public Double getDistances() {
  139 + return distances;
  140 + }
  141 +
  142 + public void setDistances(Double distances) {
  143 + this.distances = distances;
  144 + }
  145 +
  146 + public Double getToTime() {
  147 + return toTime;
  148 + }
  149 +
  150 + public void setToTime(Double toTime) {
  151 + this.toTime = toTime;
  152 + }
  153 +
  154 + public String getFirstTime() {
  155 + return firstTime;
  156 + }
  157 +
  158 + public void setFirstTime(String firstTime) {
  159 + this.firstTime = firstTime;
  160 + }
  161 +
  162 + public String getEndTime() {
  163 + return endTime;
  164 + }
  165 +
  166 + public void setEndTime(String endTime) {
  167 + this.endTime = endTime;
  168 + }
  169 +
  170 + public Integer getDirections() {
  171 + return directions;
  172 + }
  173 +
  174 + public void setDirections(Integer directions) {
  175 + this.directions = directions;
  176 + }
  177 +
  178 + public Integer getVersions() {
  179 + return versions;
  180 + }
  181 +
  182 + public void setVersions(Integer versions) {
  183 + this.versions = versions;
  184 + }
  185 +
  186 + public Integer getDestroy() {
  187 + return destroy;
  188 + }
  189 +
  190 + public void setDestroy(Integer destroy) {
  191 + this.destroy = destroy;
  192 + }
  193 +
  194 + public String getDescriptions() {
  195 + return descriptions;
  196 + }
  197 +
  198 + public void setDescriptions(String descriptions) {
  199 + this.descriptions = descriptions;
  200 + }
  201 +
  202 + public Integer getCreateBy() {
  203 + return createBy;
  204 + }
  205 +
  206 + public void setCreateBy(Integer createBy) {
  207 + this.createBy = createBy;
  208 + }
  209 +
  210 + public Integer getUpdateBy() {
  211 + return updateBy;
  212 + }
  213 +
  214 + public void setUpdateBy(Integer updateBy) {
  215 + this.updateBy = updateBy;
  216 + }
  217 +
  218 + public Date getCreateDate() {
  219 + return createDate;
  220 + }
  221 +
  222 + public void setCreateDate(Date createDate) {
  223 + this.createDate = createDate;
  224 + }
  225 +
  226 + public Date getUpdateDate() {
  227 + return updateDate;
  228 + }
  229 +
  230 + public void setUpdateDate(Date updateDate) {
  231 + this.updateDate = updateDate;
  232 + }
  233 +
  234 + public Integer getStation() {
  235 + return station;
  236 + }
  237 +
  238 + public void setStation(Integer station) {
  239 + this.station = station;
  240 + }
  241 +
  242 + public Integer getLine() {
  243 + return line;
  244 + }
  245 +
  246 + public void setLine(Integer line) {
  247 + this.line = line;
  248 + }
  249 +}
... ...
src/main/java/com/bsth/data/line_version/thread/FixedEnableVerionsThread.java 0 → 100644
  1 +package com.bsth.data.line_version.thread;
  2 +
  3 +import com.bsth.data.line_version.EnableRouteVersionHandler;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
  6 +import org.springframework.beans.factory.annotation.Autowired;
  7 +import org.springframework.jdbc.core.JdbcTemplate;
  8 +import org.springframework.stereotype.Component;
  9 +
  10 +import java.util.List;
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by panzhao on 2017/12/28.
  15 + */
  16 +@Component
  17 +public class FixedEnableVerionsThread extends Thread{
  18 +
  19 + @Autowired
  20 + JdbcTemplate jdbcTemplate;
  21 +
  22 + Logger logger = LoggerFactory.getLogger(this.getClass());
  23 +
  24 + @Autowired
  25 + EnableRouteVersionHandler enableRouteVersionHandler;
  26 +
  27 + @Override
  28 + public void run() {
  29 + try{
  30 +
  31 + String sql = "select * from bsth_c_line_versions where status=2 and start_date<=SYSDATE()";
  32 +
  33 + List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
  34 + if(list.size() == 0)
  35 + return;
  36 +
  37 + String lineCode;
  38 + int version;
  39 +
  40 + for(Map<String, Object> map : list){
  41 + lineCode = map.get("line_code").toString();
  42 + version = Integer.parseInt(map.get("versions").toString());
  43 +
  44 + enableRouteVersionHandler.enable(lineCode, version);
  45 + }
  46 + }catch (Exception e){
  47 + logger.error("", e);
  48 + }
  49 + }
  50 +}
... ...
src/main/java/com/bsth/data/schedule/ScheduleComparator.java
1 1 package com.bsth.data.schedule;
2 2  
3 3 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  4 +import org.slf4j.Logger;
  5 +import org.slf4j.LoggerFactory;
4 6  
5 7 import java.util.Comparator;
6 8 import java.util.HashMap;
... ... @@ -23,6 +25,7 @@ public class ScheduleComparator {
23 25 }
24 26 }*/
25 27  
  28 +
26 29 static Map<String, Integer> bcTypeOrderMap = new HashMap<>();
27 30  
28 31 static{
... ... @@ -50,10 +53,44 @@ public class ScheduleComparator {
50 53  
51 54 public static class DFSJ implements Comparator<ScheduleRealInfo>{
52 55  
  56 + static Logger logger = LoggerFactory.getLogger(DFSJ.class);
  57 +
53 58 @Override
54 59 public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
55   - int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
56   - return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  60 + try{
  61 +
  62 + if(!s1.getXlBm().equals(s2.getXlBm()) || !s1.getLpName().equals(s2.getLpName())){
  63 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  64 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  65 + }
  66 + else{
  67 + /**
  68 + * 按时刻表发车顺序号
  69 + */
  70 + Integer fc1 = s1.getFcno();
  71 + Integer fc2 = s2.getFcno();
  72 + if(null != fc1 && null != fc2){
  73 + return fc1.intValue()==fc2.intValue()?0:fc1.intValue()-fc2.intValue();
  74 + }
  75 + else{
  76 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  77 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  78 + }
  79 + }
  80 + }catch (Exception e){
  81 + logger.error("排序异常", e);
  82 + return s1.getDfsjT() - s2.getDfsjT() > 0?1:-1;
  83 + }
57 84 }
58 85 }
  86 +
  87 + public static class DFSJ2 implements Comparator<ScheduleRealInfo>{
  88 +
  89 +
  90 + @Override
  91 + public int compare(ScheduleRealInfo s1, ScheduleRealInfo s2) {
  92 + int diff = (int) (s1.getDfsjT() - s2.getDfsjT());
  93 + return diff!=0?diff:typeOrder(s1.getBcType()) - typeOrder(s2.getBcType());
  94 + }
  95 + }
59 96 }
... ...
src/main/java/com/bsth/data/schedule/late_adjust/ScheduleLateThread.java
... ... @@ -35,7 +35,7 @@ public class ScheduleLateThread extends Thread{
35 35  
36 36 Logger logger = LoggerFactory.getLogger(this.getClass());
37 37  
38   - private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ();
  38 + private static Comparator<ScheduleRealInfo> cpm = new ScheduleComparator.DFSJ2();
39 39  
40 40 @Override
41 41 public void run() {
... ...
src/main/java/com/bsth/service/geo_data/GeoDataService.java
... ... @@ -11,10 +11,10 @@ import java.util.Map;
11 11 public interface GeoDataService {
12 12  
13 13  
14   - Map<String, Object> findGeoStations(String lineCode);
  14 + Map<String, Object> findGeoStations(String lineCode, Integer version);
15 15  
16 16  
17   - Map<String, Object> findGeoRoad(String lineCode);
  17 + Map<String, Object> findGeoRoad(String lineCode,Integer version);
18 18  
19 19 Map<String, Object> updateBufferInfo(GeoStation station);
20 20  
... ... @@ -31,4 +31,12 @@ public interface GeoDataService {
31 31 Map<String,Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId);
32 32  
33 33 Map<String,Object> findVersionInfo(String lineCode);
  34 +
  35 + Map<String,Object> addNewLineVersion(Map<String, Object> map);
  36 +
  37 + Map<String,Object> deleteLineVersion(String lineCode, int version);
  38 +
  39 + Map<String,Object> findFutureVersion(String lineCode);
  40 +
  41 + Map<String,Object> addEnableInfo(String lineCode, int version, String enableTime);
34 42 }
... ...
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java
1 1 package com.bsth.service.geo_data.impl;
2 2  
3 3 import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.LineVersions;
4 5 import com.bsth.entity.geo_data.GeoLineVersionInfo;
5 6 import com.bsth.entity.geo_data.GeoRoad;
6 7 import com.bsth.entity.geo_data.GeoStation;
7 8 import com.bsth.service.geo_data.GeoDataService;
  9 +import com.bsth.service.geo_data.impl.dto.CascadeSaveRoad;
  10 +import com.bsth.service.geo_data.impl.dto.CascadeSaveStation;
  11 +import com.bsth.service.geo_data.impl.dto.SaveRoadRouteDTO;
  12 +import com.bsth.service.geo_data.impl.dto.SaveStationRouteDTO;
8 13 import com.bsth.util.GetUIDAndCode;
9 14 import com.bsth.util.TransGPS;
10 15 import com.google.common.base.Splitter;
... ... @@ -22,6 +27,7 @@ import org.springframework.transaction.support.DefaultTransactionDefinition;
22 27  
23 28 import java.sql.PreparedStatement;
24 29 import java.sql.SQLException;
  30 +import java.text.SimpleDateFormat;
25 31 import java.util.*;
26 32  
27 33 /**
... ... @@ -36,11 +42,20 @@ public class GeoDataServiceImpl implements GeoDataService {
36 42 Logger logger = LoggerFactory.getLogger(this.getClass());
37 43  
38 44 @Override
39   - public Map<String, Object> findGeoStations(String lineCode) {
  45 + public Map<String, Object> findGeoStations(String lineCode, Integer version) {
40 46  
41 47 Map<String, Object> map = new HashMap();
42 48 try {
43   - String sql = "select t1.*,t2.g_lonx,g_laty,ST_AsText(g_polygon_grid) as g_polygon_grid,radius,shapes_type from (select id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions from bsth_c_ls_stationroute where line=" + lineCode + " and destroy=0 and versions in (select DISTINCT versions from bsth_c_stationroute where line=" + lineCode + " and destroy=0)) t1 LEFT JOIN bsth_c_station t2 on t1.station_code=t2.station_cod";
  49 +
  50 + String sql = "select versions from bsth_c_line_versions where line='"+lineCode+"' and status=1";
  51 + //当前使用的线路版本
  52 + Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class);
  53 +
  54 +
  55 + if(null == version)
  56 + version = currentVersion;
  57 +
  58 + sql = "select t1.*,t2.g_lonx,g_laty,ST_AsText(g_polygon_grid) as g_polygon_grid,radius,shapes_type from (select id,station_name,station_route_code,line_code,station_code,station_mark,versions,directions from bsth_c_ls_stationroute where line=" + lineCode + " and destroy=0 and versions="+version+") t1 LEFT JOIN bsth_c_station t2 on t1.station_code=t2.station_cod";
44 59  
45 60  
46 61 List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class));
... ... @@ -51,6 +66,8 @@ public class GeoDataServiceImpl implements GeoDataService {
51 66 }
52 67 map.put("status", ResponseCode.SUCCESS);
53 68 map.put("list", list);
  69 + map.put("currentVersion", currentVersion);
  70 + map.put("editVersion", version);
54 71 } catch (Exception e) {
55 72 logger.error("", e);
56 73 map.put("status", ResponseCode.ERROR);
... ... @@ -60,10 +77,20 @@ public class GeoDataServiceImpl implements GeoDataService {
60 77 }
61 78  
62 79 @Override
63   - public Map<String, Object> findGeoRoad(String lineCode) {
  80 + public Map<String, Object> findGeoRoad(String lineCode,Integer version) {
64 81 Map<String, Object> map = new HashMap();
65 82 try {
66   - String sql = "select t1.*,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector from (select id,sectionroute_code,directions,line_code,section_code,versions from bsth_c_ls_sectionroute where line=" + lineCode + " and destroy=0 and versions in (select DISTINCT versions from bsth_c_sectionroute where line=" + lineCode + " and destroy=0)) t1 LEFT JOIN bsth_c_section t2 on t1.section_code=t2.section_code";
  83 +
  84 + String sql = "select versions from bsth_c_line_versions where line='"+lineCode+"' and status=1";
  85 + //当前使用的线路版本
  86 + Integer currentVersion = jdbcTemplate.queryForObject(sql, Integer.class);
  87 +
  88 +
  89 + if(null == version)
  90 + version = currentVersion;
  91 +
  92 +
  93 + sql = "select t1.*,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector from (select id,sectionroute_code,directions,line_code,section_code,versions from bsth_c_ls_sectionroute where line=" + lineCode + " and destroy=0 and versions="+version+") t1 LEFT JOIN bsth_c_section t2 on t1.section_code=t2.section_code";
67 94  
68 95  
69 96 List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class));
... ... @@ -169,7 +196,7 @@ public class GeoDataServiceImpl implements GeoDataService {
169 196 }
170 197  
171 198 @Override
172   - public Map<String, Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName,String crosesRoad, String coords, int prevRouteId) {
  199 + public Map<String, Object> addNewRoadRoute(String lineCode, int upDown, int versions, String sectionName, String crosesRoad, String coords, int prevRouteId) {
173 200 Map<String, Object> rs = new HashMap<>();
174 201  
175 202 //编程式事务
... ... @@ -178,7 +205,7 @@ public class GeoDataServiceImpl implements GeoDataService {
178 205 def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
179 206 TransactionStatus status = tran.getTransaction(def);
180 207 try {
181   - //根据站点编码,查询站点ID
  208 + //根据线路编码,查询线路ID
182 209 int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class);
183 210  
184 211 String sql = "select * from bsth_c_ls_sectionroute where line_code='" + lineCode + "' and line=" + lineId + " and directions=" + upDown + " and destroy=0 and versions=" + versions;
... ... @@ -192,7 +219,7 @@ public class GeoDataServiceImpl implements GeoDataService {
192 219 String bdCooed = "LINESTRING(" + coords + ")";
193 220 //insert 路段
194 221 sql = "insert into bsth_c_section(id, section_code, section_name, croses_road, bsection_vector, gsection_vector, create_date, update_date, versions) " +
195   - " values(?,?,?,?,ST_GeomFromText('"+bdCooed+"'),ST_GeomFromText('"+wgsCoord+"'),sysdate(),sysdate(),?)";
  222 + " values(?,?,?,?,ST_GeomFromText('" + bdCooed + "'),ST_GeomFromText('" + wgsCoord + "'),sysdate(),sysdate(),?)";
196 223  
197 224 jdbcTemplate.update(sql, sCode, sCode, sectionName, crosesRoad, 1);
198 225  
... ... @@ -269,6 +296,7 @@ public class GeoDataServiceImpl implements GeoDataService {
269 296  
270 297 /**
271 298 * 获取线路版本信息
  299 + *
272 300 * @param lineCode
273 301 * @return
274 302 */
... ... @@ -277,10 +305,10 @@ public class GeoDataServiceImpl implements GeoDataService {
277 305 Map<String, Object> rs = new HashMap<>();
278 306  
279 307 try {
280   - String sql = "select t1.*,t2.name as line_name from bsth_c_line_versions t1 LEFT JOIN bsth_c_line t2 on t1.line_code=t2.line_code where t1.line_code='"+lineCode+"'";
  308 + String sql = "select t1.*,t2.name as line_name from bsth_c_line_versions t1 LEFT JOIN bsth_c_line t2 on t1.line_code=t2.line_code where t1.line_code='" + lineCode + "'";
281 309  
282 310 List<GeoLineVersionInfo> list =
283   - jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoLineVersionInfo.class));
  311 + jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoLineVersionInfo.class));
284 312  
285 313 rs.put("list", list);
286 314 rs.put("status", ResponseCode.SUCCESS);
... ... @@ -293,6 +321,326 @@ public class GeoDataServiceImpl implements GeoDataService {
293 321 }
294 322  
295 323 @Override
  324 + public Map<String, Object> addNewLineVersion(Map<String, Object> map) {
  325 + Map<String, Object> rs = new HashMap<>();
  326 +
  327 + //编程式事务
  328 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  329 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  330 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  331 + TransactionStatus status = tran.getTransaction(def);
  332 + try {
  333 +
  334 + String lineCode = map.get("lineCode").toString();
  335 + String remark = map.get("remark").toString();
  336 + String name = map.get("name").toString();
  337 + Date startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(map.get("startDate").toString());
  338 + int extendsVersion = Integer.parseInt(map.get("extendsVersion").toString());
  339 +
  340 + if(startDate.getTime() - System.currentTimeMillis() < 1000 * 60 * 3){
  341 + rs.put("status", ResponseCode.ERROR);
  342 + rs.put("msg", "启用时间最少需要晚于当前服务器时间3分钟!");
  343 + return rs;
  344 + }
  345 +
  346 + int nameCount = jdbcTemplate.queryForObject("select count(*) from bsth_c_line_versions where line_code=" + lineCode + " and name='"+name+"'", Integer.class);
  347 + if(nameCount > 0){
  348 + rs.put("status", ResponseCode.ERROR);
  349 + rs.put("msg", "你不能使用一个已经存在的版本名称!!");
  350 + return rs;
  351 + }
  352 +
  353 + //当前最大的版本号
  354 + int maxVersion = jdbcTemplate.queryForObject("select max(versions) as versions from bsth_c_line_versions where line_code=" + lineCode, Integer.class);
  355 + Date d = new Date();
  356 +
  357 + //根据线路编码,查询线路ID
  358 + int lineId = jdbcTemplate.queryForObject("select id from bsth_c_line where line_code=" + lineCode, Integer.class);
  359 +
  360 + maxVersion += 1;
  361 + LineVersions lVersion = new LineVersions();
  362 + lVersion.setName(name);
  363 + lVersion.setVersions(maxVersion);
  364 + lVersion.setRemark(remark);
  365 + lVersion.setStartDate(startDate);
  366 + lVersion.setStatus(2);
  367 + lVersion.setCreateDate(d);
  368 + lVersion.setUpdateDate(d);
  369 + lVersion.setLineCode(lineCode);
  370 +
  371 + //如果有待启用的版本,设置为历史版本
  372 + jdbcTemplate.update("update bsth_c_line_versions set `status`=0, start_date=null,end_date=null where line_code='"+lineCode+"' and `status`=2");
  373 +
  374 + //入库线路版本
  375 + jdbcTemplate.update("insert into bsth_c_line_versions(name, line, line_code, versions, start_date, create_date, update_date, remark,status, isupdate) " +
  376 + " values(?,?,?,?,?,?,?,?,?,?)", lVersion.getName(), lineId, lVersion.getLineCode()
  377 + , lVersion.getVersions(), lVersion.getStartDate(), lVersion.getCreateDate(), lVersion.getUpdateDate(), lVersion.getRemark(), lVersion.getStatus(), lVersion.getIsupdate());
  378 +
  379 + if (extendsVersion != -1) {
  380 + //复制站点信息
  381 + String sql = "SELECT t1.id AS route_id,t1.line,t1.directions,t1.station,t1.station_name,t1.station_route_code,t1.line_code,t1.station_code,t1.station_mark,t1.distances,t1.to_time,t2.id AS station_id,t2.db_type,t2.b_jwpoints,t2.g_lonx,t2.g_laty,t2.radius,ST_AsText(t2.g_polygon_grid) as g_polygon_grid,t2.shapes_type FROM bsth_c_ls_stationroute t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod where t1.destroy=0 and t1.line_code='" + lineCode + "' and t1.versions="+extendsVersion+" order by t1.directions, t1.station_route_code";
  382 + List<CascadeSaveStation> cssList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(CascadeSaveStation.class));
  383 +
  384 + //新的站点编码
  385 + long sCode;
  386 + for (CascadeSaveStation ss : cssList) {
  387 + sCode = GetUIDAndCode.getStationId();
  388 + ss.setRouteId(null);
  389 + ss.setStationCode(sCode + "");
  390 + ss.setStation((int) sCode);
  391 + }
  392 + //入库新版本的站点 和 路由
  393 + batchInsertStation(cssList, maxVersion);
  394 +
  395 + //复制路段信息
  396 + sql = "SELECT t1.id AS route_id,t1.line,t1.line_code,t1.directions,t1.section,t1.section_code,t1.sectionroute_code,t1.versions,t2.section_name,t2.croses_road,ST_AsText(t2.gsection_vector) as gsection_vector,t2.db_type,t2.speed_limit FROM bsth_c_ls_sectionroute t1 LEFT JOIN bsth_c_section t2 ON t1.section_code = t2.section_code WHERE t1.destroy = 0 AND t1.line_code = '"+lineCode+"' and t1.versions="+ extendsVersion +" ORDER BY t1.directions,t1.sectionroute_code";
  397 + List<CascadeSaveRoad> csrList = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(CascadeSaveRoad.class));
  398 + //新的路段编码
  399 + long cCode;
  400 + for(CascadeSaveRoad csr : csrList){
  401 + cCode = GetUIDAndCode.getSectionId();
  402 + csr.setRouteId(null);
  403 + csr.setSection((int) cCode);
  404 + csr.setSectionCode(cCode + "");
  405 + }
  406 + //入库新版本的路段 和 路段路由
  407 + batchInsertRoad(csrList, maxVersion);
  408 + }
  409 +
  410 + tran.commit(status);
  411 + rs.put("newVersion", maxVersion);
  412 + rs.put("status", ResponseCode.SUCCESS);
  413 + } catch (Exception e) {
  414 + tran.rollback(status);
  415 + logger.error("", e);
  416 + rs.put("status", ResponseCode.ERROR);
  417 + rs.put("msg", "服务器出现异常");
  418 + }
  419 + return rs;
  420 + }
  421 +
  422 + /**
  423 + * 删除一个线路走向版本
  424 + * @param lineCode
  425 + * @param version
  426 + * @return
  427 + */
  428 + @Override
  429 + public Map<String, Object> deleteLineVersion(String lineCode, int version) {
  430 + Map<String, Object> rs = new HashMap<>();
  431 +
  432 + //编程式事务
  433 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  434 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  435 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  436 + TransactionStatus status = tran.getTransaction(def);
  437 + try{
  438 + int enableVersion = jdbcTemplate.queryForObject("select versions from bsth_c_line_versions where line_code='"+lineCode+"' and `status`=1", Integer.class);
  439 +
  440 + if(enableVersion==version){
  441 + rs.put("status", ResponseCode.ERROR);
  442 + rs.put("msg", "你不能删除当前正在启用的走向版本!");
  443 + return rs;
  444 + }
  445 + /*int versionCount = jdbcTemplate.queryForObject("select count(*) from bsth_c_line_versions where line_code='"+lineCode+"'", Integer.class);
  446 + if(versionCount == 1){
  447 + rs.put("status", ResponseCode.ERROR);
  448 + rs.put("msg", "线路至少要保留一个走向版本!");
  449 + return rs;
  450 + }*/
  451 +
  452 + /* //要删除的站点ID(未被其他线路、版本引用的)
  453 + String sql = "select DISTINCT station from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions="+version+" and station not in(" +
  454 + "select station from bsth_c_ls_stationroute where (line!='"+lineCode+"' or versions!="+version+") and station in (" +
  455 + "select station from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions="+version +
  456 + "))";
  457 +
  458 + List<Integer> stationRemoves = jdbcTemplate.queryForList(sql, Integer.class);*/
  459 +
  460 + //删除站点路由
  461 + String sql = "delete from bsth_c_ls_stationroute where line_code='"+lineCode+"' and versions=" + version;
  462 + jdbcTemplate.update(sql);
  463 +
  464 + //删除路段路由
  465 + sql = "delete from bsth_c_ls_sectionroute where line_code='"+lineCode+"' and versions=" + version;
  466 + jdbcTemplate.update(sql);
  467 +
  468 + //删除版本信息
  469 + sql = "delete from bsth_c_line_versions where line_code='"+lineCode+"' and versions=" + version;
  470 + jdbcTemplate.update(sql);
  471 +
  472 + tran.commit(status);
  473 + rs.put("status", ResponseCode.SUCCESS);
  474 + }catch (Exception e){
  475 + tran.rollback(status);
  476 + logger.error("", e);
  477 + rs.put("status", ResponseCode.ERROR);
  478 + rs.put("msg", "服务器出现异常");
  479 + }
  480 + return rs;
  481 + }
  482 +
  483 + /**
  484 + * 获取线路的待更新版本信息
  485 + * @param lineCode
  486 + * @return
  487 + */
  488 + @Override
  489 + public Map<String, Object> findFutureVersion(String lineCode) {
  490 + Map<String, Object> rs = new HashMap();
  491 + try{
  492 + List<Map<String, Object>> list = jdbcTemplate.queryForList("select * from bsth_c_line_versions where line_code='"+lineCode+"' and `status`=2 order by start_date");
  493 +
  494 + rs.put("data", list);
  495 + rs.put("status", ResponseCode.SUCCESS);
  496 + }catch (Exception e){
  497 + logger.error("", e);
  498 + rs.put("status", ResponseCode.ERROR);
  499 + rs.put("msg", "服务器出现异常");
  500 + }
  501 + return rs;
  502 + }
  503 +
  504 + @Override
  505 + public Map<String, Object> addEnableInfo(String lineCode, int version, String enableTime) {
  506 + Map<String, Object> rs = new HashMap();
  507 + try{
  508 + Date startDate = new SimpleDateFormat("yyyy-MM-dd HH:mm").parse(enableTime);
  509 + if(startDate.getTime() - System.currentTimeMillis() < 1000 * 60 * 3){
  510 + rs.put("status", ResponseCode.ERROR);
  511 + rs.put("msg", "启用时间最少需要晚于当前服务器时间3分钟!");
  512 + return rs;
  513 + }
  514 +
  515 + jdbcTemplate.update("update bsth_c_line_versions set `status`=0 where line_code="+lineCode+" and versions=" + version);
  516 + jdbcTemplate.update("update bsth_c_line_versions set `status`=2 ,start_date=? where line_code=? and versions=?", startDate, lineCode, version);
  517 +
  518 + rs.put("status", ResponseCode.SUCCESS);
  519 + }catch (Exception e){
  520 + logger.error("", e);
  521 + rs.put("status", ResponseCode.ERROR);
  522 + rs.put("msg", "服务器出现异常");
  523 + }
  524 + return rs;
  525 + }
  526 +
  527 + /**
  528 + * 批量入库路段
  529 + * @param cssList
  530 + * @param version
  531 + */
  532 + private void batchInsertRoad(final List<CascadeSaveRoad> csrList, final int version){
  533 + final Date d = new Date();
  534 + jdbcTemplate.batchUpdate("insert into bsth_c_section(id, section_code, section_name, croses_road, gsection_vector, create_date, update_date, versions) " +
  535 + " values(?,?,?,?,ST_GeomFromText(?),?,?,?)", new BatchPreparedStatementSetter() {
  536 + @Override
  537 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  538 + CascadeSaveRoad csr = csrList.get(i);
  539 + ps.setInt(1, csr.getSection());
  540 + ps.setString(2, csr.getSectionCode());
  541 + ps.setString(3, csr.getSectionName());
  542 + ps.setString(4, csr.getCrosesRoad());
  543 + ps.setString(5, csr.getGsectionVector());
  544 + ps.setTimestamp(6, new java.sql.Timestamp(d.getTime()));
  545 + ps.setTimestamp(7, new java.sql.Timestamp(d.getTime()));
  546 + ps.setInt(8, version);
  547 + }
  548 +
  549 + @Override
  550 + public int getBatchSize() {
  551 + return csrList.size();
  552 + }
  553 + });
  554 +
  555 + //路由
  556 + jdbcTemplate.batchUpdate("insert into bsth_c_ls_sectionroute(line_code, section_code, sectionroute_code, directions, line, section, create_date,update_date,versions,destroy,is_roade_speed) " +
  557 + " values(?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  558 + @Override
  559 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  560 + CascadeSaveRoad csr = csrList.get(i);
  561 + ps.setString(1, csr.getLineCode());
  562 + ps.setString(2, csr.getSectionCode());
  563 + ps.setInt(3, csr.getSectionrouteCode());
  564 + ps.setInt(4, csr.getDirections());
  565 + ps.setInt(5, csr.getLine());
  566 + ps.setInt(6, csr.getSection());
  567 + ps.setTimestamp(7, new java.sql.Timestamp(d.getTime()));
  568 + ps.setTimestamp(8, new java.sql.Timestamp(d.getTime()));
  569 + ps.setInt(9, version);
  570 + ps.setInt(10, 0);
  571 + ps.setInt(11, 0);
  572 + }
  573 +
  574 + @Override
  575 + public int getBatchSize() {
  576 + return csrList.size();
  577 + }
  578 + });
  579 + }
  580 +
  581 + /**
  582 + * 批量插入站点
  583 + *
  584 + * @param cssList
  585 + */
  586 + private void batchInsertStation(final List<CascadeSaveStation> cssList, final int version) {
  587 + //站点
  588 + jdbcTemplate.batchUpdate("insert into bsth_c_station(id, station_cod, station_name, db_type, b_jwpoints, g_lonx, g_laty, destroy, radius, shapes_type, versions, g_polygon_grid) " +
  589 + " values(?,?,?,?,?,?,?,?,?,?,?,ST_GeomFromText(?))", new BatchPreparedStatementSetter() {
  590 + @Override
  591 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  592 + CascadeSaveStation ss = cssList.get(i);
  593 + ps.setInt(1, ss.getStation());
  594 + ps.setString(2, ss.getStationCode());
  595 + ps.setString(3, ss.getStationName());
  596 + ps.setString(4, "b");
  597 + ps.setString(5, ss.getbJwpoints());
  598 + ps.setDouble(6, ss.getgLonx());
  599 + ps.setDouble(7, ss.getgLaty());
  600 + ps.setInt(8, 0);
  601 + ps.setInt(9, ss.getRadius()==null?0:ss.getRadius());
  602 + ps.setString(10, ss.getShapesType());
  603 + ps.setInt(11, version);
  604 + ps.setString(12, ss.getgPolygonGrid());
  605 + }
  606 +
  607 + @Override
  608 + public int getBatchSize() {
  609 + return cssList.size();
  610 + }
  611 + });
  612 +
  613 + final Date d = new Date();
  614 + //站点路由
  615 + jdbcTemplate.batchUpdate("insert into bsth_c_ls_stationroute(line, station, station_name, station_route_code, line_code, station_code, station_mark, distances, to_time, destroy, versions, create_date, update_date,directions) " +
  616 + " values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  617 + @Override
  618 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  619 + CascadeSaveStation ss = cssList.get(i);
  620 + ps.setInt(1, ss.getLine());
  621 + ps.setInt(2, ss.getStation());
  622 + ps.setString(3, ss.getStationName());
  623 + ps.setInt(4, ss.getStationRouteCode());
  624 + ps.setString(5, ss.getLineCode());
  625 + ps.setString(6, ss.getStationCode());
  626 + ps.setString(7, ss.getStationMark());
  627 + ps.setDouble(8, ss.getDistances());
  628 + ps.setDouble(9, ss.getToTime());
  629 + ps.setInt(10, 0);
  630 + ps.setInt(11, version);
  631 + ps.setTimestamp(12, new java.sql.Timestamp(d.getTime()));
  632 + ps.setTimestamp(13, new java.sql.Timestamp(d.getTime()));
  633 + ps.setInt(14, ss.getDirections());
  634 + }
  635 +
  636 + @Override
  637 + public int getBatchSize() {
  638 + return cssList.size();
  639 + }
  640 + });
  641 + }
  642 +
  643 + @Override
296 644 public Map<String, Object> addNewStationRoute(String lineCode, int upDown, int versions, String stationName, Float lat, Float lng, int prevRouteId) {
297 645 Map<String, Object> rs = new HashMap<>();
298 646  
... ... @@ -362,6 +710,10 @@ public class GeoDataServiceImpl implements GeoDataService {
362 710 nsr.setCreateDate(d);
363 711 nsr.setUpdateDate(d);
364 712 nsr.setDestroy(0);
  713 + if (prevRouteId == -1)
  714 + nsr.setStationMark("B");
  715 + else if(routes.size()==1)
  716 + nsr.setStationMark("E");
365 717  
366 718 //routes.add(sr);
367 719  
... ... @@ -370,8 +722,10 @@ public class GeoDataServiceImpl implements GeoDataService {
370 722 for (int i = 0, size = routes.size(); i < size; i++) {
371 723 routes.get(i).setStationMark("Z");
372 724 }
373   - routes.get(0).setStationMark("B");
374   - routes.get(routes.size() - 1).setStationMark("E");
  725 + if(routes.size() > 0 && prevRouteId!=-1)
  726 + routes.get(0).setStationMark("B");
  727 + if(routes.size() > 1)
  728 + routes.get(routes.size() - 1).setStationMark("E");
375 729  
376 730 final List<SaveStationRouteDTO> saveList = routes;
377 731 //insert 新路由 (ID自增)
... ... @@ -454,15 +808,68 @@ public class GeoDataServiceImpl implements GeoDataService {
454 808 public Map<String, Object> destroyStation(GeoStation station) {
455 809 Map<String, Object> rs = new HashMap<>();
456 810  
  811 + //编程式事务
  812 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  813 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  814 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  815 + TransactionStatus status = tran.getTransaction(def);
457 816 try {
458 817 String sql = "update bsth_c_ls_stationroute set destroy=1 where id=?";
459 818 jdbcTemplate.update(sql, station.getId());
460 819  
  820 + //重新排序路由,标记mark
  821 + sql = "select * from bsth_c_ls_stationroute where line_code='" + station.getLineCode() + "' and directions=" + station.getDirections() + " and destroy=0 and versions=" + station.getVersions();
  822 + List<SaveStationRouteDTO> routes = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(SaveStationRouteDTO.class));
  823 + Collections.sort(routes, new StationRouteComp());
  824 +
  825 + for (int i = 0, size = routes.size(); i < size; i++) {
  826 + routes.get(i).setStationMark("Z");
  827 + }
  828 + if(routes.size() > 0)
  829 + routes.get(0).setStationMark("B");
  830 + if(routes.size() > 1)
  831 + routes.get(routes.size() - 1).setStationMark("E");
  832 +
  833 + final List<SaveStationRouteDTO> saveList = routes;
  834 + // update 原路由
  835 + jdbcTemplate.batchUpdate("update bsth_c_ls_stationroute set line=?,station=?,station_name=?,station_route_code=?," +
  836 + "line_code=?,station_code=?,station_mark=?,distances=?,to_time=?,destroy=?,versions=?,create_date=?,update_date=?,directions=?" +
  837 + " where id=?"
  838 + , new BatchPreparedStatementSetter() {
  839 + @Override
  840 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  841 + SaveStationRouteDTO sr = saveList.get(i);
  842 + ps.setInt(1, sr.getLine());
  843 + ps.setLong(2, sr.getStation());
  844 + ps.setString(3, sr.getStationName());
  845 + ps.setInt(4, sr.getStationRouteCode());
  846 + ps.setString(5, sr.getLineCode());
  847 + ps.setString(6, sr.getStationCode());
  848 + ps.setString(7, sr.getStationMark());
  849 + ps.setDouble(8, sr.getDistances());
  850 + ps.setDouble(9, sr.getToTime());
  851 + ps.setInt(10, sr.getDestroy());
  852 + ps.setInt(11, sr.getVersions());
  853 + ps.setTimestamp(12, new java.sql.Timestamp(sr.getCreateDate().getTime()));
  854 + ps.setTimestamp(13, new java.sql.Timestamp(sr.getUpdateDate().getTime()));
  855 + ps.setInt(14, sr.getDirections());
  856 + ps.setInt(15, sr.getId());
  857 + }
  858 +
  859 + @Override
  860 + public int getBatchSize() {
  861 + return saveList.size();
  862 + }
  863 + });
  864 +
  865 + tran.commit(status);
  866 +
461 867 //返回更新之后的数据
462 868 List<GeoStation> list = findByUpdown(station.getLineCode(), station.getDirections(), station.getVersions());
463 869 rs.put("list", list);
464 870 rs.put("status", ResponseCode.SUCCESS);
465 871 } catch (Exception e) {
  872 + tran.rollback(status);
466 873 logger.error("", e);
467 874 rs.put("status", ResponseCode.ERROR);
468 875 rs.put("msg", "服务器出现异常");
... ...
src/main/java/com/bsth/service/geo_data/impl/dto/CascadeSaveRoad.java 0 → 100644
  1 +package com.bsth.service.geo_data.impl.dto;
  2 +
  3 +/**
  4 + * 级联入库的路段 和 路段路由
  5 + * Created by panzhao on 2017/12/25.
  6 + */
  7 +public class CascadeSaveRoad {
  8 +
  9 + private Integer routeId;
  10 +
  11 + private Integer line;
  12 +
  13 + private String lineCode;
  14 +
  15 + private int directions;
  16 +
  17 + private Integer section;
  18 +
  19 + private String sectionCode;
  20 +
  21 + private Integer sectionrouteCode;
  22 +
  23 + private int versions;
  24 +
  25 + private String sectionName;
  26 +
  27 + private String crosesRoad;
  28 +
  29 + private String gsectionVector;
  30 +
  31 + private String dbType;
  32 +
  33 + private Integer speedLimit;
  34 +
  35 + public Integer getRouteId() {
  36 + return routeId;
  37 + }
  38 +
  39 + public void setRouteId(Integer routeId) {
  40 + this.routeId = routeId;
  41 + }
  42 +
  43 + public Integer getLine() {
  44 + return line;
  45 + }
  46 +
  47 + public void setLine(Integer line) {
  48 + this.line = line;
  49 + }
  50 +
  51 + public String getLineCode() {
  52 + return lineCode;
  53 + }
  54 +
  55 + public void setLineCode(String lineCode) {
  56 + this.lineCode = lineCode;
  57 + }
  58 +
  59 + public Integer getSection() {
  60 + return section;
  61 + }
  62 +
  63 + public void setSection(Integer section) {
  64 + this.section = section;
  65 + }
  66 +
  67 + public String getSectionCode() {
  68 + return sectionCode;
  69 + }
  70 +
  71 + public void setSectionCode(String sectionCode) {
  72 + this.sectionCode = sectionCode;
  73 + }
  74 +
  75 + public Integer getSectionrouteCode() {
  76 + return sectionrouteCode;
  77 + }
  78 +
  79 + public void setSectionrouteCode(Integer sectionrouteCode) {
  80 + this.sectionrouteCode = sectionrouteCode;
  81 + }
  82 +
  83 + public int getVersions() {
  84 + return versions;
  85 + }
  86 +
  87 + public void setVersions(int versions) {
  88 + this.versions = versions;
  89 + }
  90 +
  91 + public String getSectionName() {
  92 + return sectionName;
  93 + }
  94 +
  95 + public void setSectionName(String sectionName) {
  96 + this.sectionName = sectionName;
  97 + }
  98 +
  99 + public String getCrosesRoad() {
  100 + return crosesRoad;
  101 + }
  102 +
  103 + public void setCrosesRoad(String crosesRoad) {
  104 + this.crosesRoad = crosesRoad;
  105 + }
  106 +
  107 + public String getGsectionVector() {
  108 + return gsectionVector;
  109 + }
  110 +
  111 + public void setGsectionVector(String gsectionVector) {
  112 + this.gsectionVector = gsectionVector;
  113 + }
  114 +
  115 + public String getDbType() {
  116 + return dbType;
  117 + }
  118 +
  119 + public void setDbType(String dbType) {
  120 + this.dbType = dbType;
  121 + }
  122 +
  123 + public Integer getSpeedLimit() {
  124 + return speedLimit;
  125 + }
  126 +
  127 + public void setSpeedLimit(Integer speedLimit) {
  128 + this.speedLimit = speedLimit;
  129 + }
  130 +
  131 + public int getDirections() {
  132 + return directions;
  133 + }
  134 +
  135 + public void setDirections(int directions) {
  136 + this.directions = directions;
  137 + }
  138 +}
... ...
src/main/java/com/bsth/service/geo_data/impl/dto/CascadeSaveStation.java 0 → 100644
  1 +package com.bsth.service.geo_data.impl.dto;
  2 +
  3 +/**
  4 + * 站点和路由级联入库
  5 + * Created by panzhao on 2017/12/21.
  6 + */
  7 +public class CascadeSaveStation {
  8 +
  9 + /**
  10 + * 路由id
  11 + */
  12 + private Integer routeId;
  13 +
  14 + /**
  15 + * 线路id
  16 + */
  17 + private Integer line;
  18 +
  19 + /**
  20 + * 上下行
  21 + */
  22 + private int directions;
  23 +
  24 + /**
  25 + * 站点id
  26 + */
  27 + private Integer station;
  28 +
  29 + /**
  30 + * 站点名称
  31 + */
  32 + private String stationName;
  33 +
  34 + /**
  35 + * 路由顺序
  36 + */
  37 + private Integer stationRouteCode;
  38 +
  39 + /**
  40 + * 线路编码
  41 + */
  42 + private String lineCode;
  43 +
  44 + /**
  45 + * 站点编码
  46 + */
  47 + private String stationCode;
  48 +
  49 + private String stationMark;
  50 +
  51 + private Double distances;
  52 +
  53 + private Double toTime;
  54 +
  55 + private Integer stationId;
  56 +
  57 + private String dbType;
  58 +
  59 + private String bJwpoints;
  60 +
  61 + private Float gLonx;
  62 +
  63 + private Float gLaty;
  64 +
  65 + private Integer radius;
  66 +
  67 + private String shapesType;
  68 +
  69 + private String gPolygonGrid;
  70 +
  71 +
  72 +
  73 + public Integer getLine() {
  74 + return line;
  75 + }
  76 +
  77 + public void setLine(Integer line) {
  78 + this.line = line;
  79 + }
  80 +
  81 + public Integer getStation() {
  82 + return station;
  83 + }
  84 +
  85 + public void setStation(Integer station) {
  86 + this.station = station;
  87 + }
  88 +
  89 + public String getStationName() {
  90 + return stationName;
  91 + }
  92 +
  93 + public void setStationName(String stationName) {
  94 + this.stationName = stationName;
  95 + }
  96 +
  97 + public Integer getStationRouteCode() {
  98 + return stationRouteCode;
  99 + }
  100 +
  101 + public void setStationRouteCode(Integer stationRouteCode) {
  102 + this.stationRouteCode = stationRouteCode;
  103 + }
  104 +
  105 + public String getLineCode() {
  106 + return lineCode;
  107 + }
  108 +
  109 + public void setLineCode(String lineCode) {
  110 + this.lineCode = lineCode;
  111 + }
  112 +
  113 + public String getStationCode() {
  114 + return stationCode;
  115 + }
  116 +
  117 + public void setStationCode(String stationCode) {
  118 + this.stationCode = stationCode;
  119 + }
  120 +
  121 + public String getStationMark() {
  122 + return stationMark;
  123 + }
  124 +
  125 + public void setStationMark(String stationMark) {
  126 + this.stationMark = stationMark;
  127 + }
  128 +
  129 + public Double getDistances() {
  130 + return distances;
  131 + }
  132 +
  133 + public void setDistances(Double distances) {
  134 + this.distances = distances;
  135 + }
  136 +
  137 + public Double getToTime() {
  138 + return toTime;
  139 + }
  140 +
  141 + public void setToTime(Double toTime) {
  142 + this.toTime = toTime;
  143 + }
  144 +
  145 + public Integer getStationId() {
  146 + return stationId;
  147 + }
  148 +
  149 + public void setStationId(Integer stationId) {
  150 + this.stationId = stationId;
  151 + }
  152 +
  153 + public String getDbType() {
  154 + return dbType;
  155 + }
  156 +
  157 + public void setDbType(String dbType) {
  158 + this.dbType = dbType;
  159 + }
  160 +
  161 + public String getbJwpoints() {
  162 + return bJwpoints;
  163 + }
  164 +
  165 + public void setbJwpoints(String bJwpoints) {
  166 + this.bJwpoints = bJwpoints;
  167 + }
  168 +
  169 + public Float getgLonx() {
  170 + return gLonx;
  171 + }
  172 +
  173 + public void setgLonx(Float gLonx) {
  174 + this.gLonx = gLonx;
  175 + }
  176 +
  177 + public Float getgLaty() {
  178 + return gLaty;
  179 + }
  180 +
  181 + public void setgLaty(Float gLaty) {
  182 + this.gLaty = gLaty;
  183 + }
  184 +
  185 + public Integer getRadius() {
  186 + return radius;
  187 + }
  188 +
  189 + public void setRadius(Integer radius) {
  190 + this.radius = radius;
  191 + }
  192 +
  193 + public String getShapesType() {
  194 + return shapesType;
  195 + }
  196 +
  197 + public void setShapesType(String shapesType) {
  198 + this.shapesType = shapesType;
  199 + }
  200 +
  201 + public String getgPolygonGrid() {
  202 + return gPolygonGrid;
  203 + }
  204 +
  205 + public void setgPolygonGrid(String gPolygonGrid) {
  206 + this.gPolygonGrid = gPolygonGrid;
  207 + }
  208 +
  209 + public int getDirections() {
  210 + return directions;
  211 + }
  212 +
  213 + public void setDirections(int directions) {
  214 + this.directions = directions;
  215 + }
  216 +
  217 + public Integer getRouteId() {
  218 + return routeId;
  219 + }
  220 +
  221 + public void setRouteId(Integer routeId) {
  222 + this.routeId = routeId;
  223 + }
  224 +}
... ...
src/main/java/com/bsth/service/geo_data/impl/SaveRoadRouteDTO.java renamed to src/main/java/com/bsth/service/geo_data/impl/dto/SaveRoadRouteDTO.java
1   -package com.bsth.service.geo_data.impl;
  1 +package com.bsth.service.geo_data.impl.dto;
2 2  
3 3 import java.util.Date;
4 4  
... ...
src/main/java/com/bsth/service/geo_data/impl/SaveStationRouteDTO.java renamed to src/main/java/com/bsth/service/geo_data/impl/dto/SaveStationRouteDTO.java
1   -package com.bsth.service.geo_data.impl;
  1 +package com.bsth.service.geo_data.impl.dto;
2 2  
3 3 import java.util.Date;
4 4  
... ...
src/main/resources/static/pages/base/carpark/add.html
... ... @@ -325,7 +325,7 @@
325 325 <a href="javascript:;" class="btn btn-outline green button-next"> 下一步
326 326 <i class="fa fa-angle-right"></i>
327 327 </a>
328   - <a href="javascript:;" class="btn green button-submit" style="display: none;"> 提交
  328 + <a href="javascript:;" class="btn green button-submit" style="display: none;" id="submintBtn"> 提交
329 329 <i class="fa fa-check"></i>
330 330 </a>
331 331 </div>
... ...
src/main/resources/static/pages/base/carpark/js/add-form-wizard.js
... ... @@ -91,6 +91,8 @@ var FormWizard = function() {
91 91 * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
92 92 */
93 93 submitHandler : function(f) {
  94 + // 防止用户多次提交
  95 + $("#submintBtn").addClass("disabled");
94 96 // 表单序列化
95 97 var params = form.serializeJSON();
96 98 if(params.shapesType=='圆形')
... ... @@ -109,6 +111,7 @@ var FormWizard = function() {
109 111 // 返回list.html页面
110 112 loadPage('/pages/base/carpark/list.html');
111 113 });
  114 + $("#submintBtn").removeClass("disabled");
112 115 }
113 116 });
114 117 $.validator.addMethod("alnum", function(value, element) {
... ...
src/main/resources/static/pages/base/company/add.html
... ... @@ -89,7 +89,7 @@
89 89 <div class="form-actions">
90 90 <div class="row">
91 91 <div class="col-md-offset-3 col-md-4">
92   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  92 + <button type="submit" class="btn green" id="submintBtn"><i class="fa fa-check"></i> 提交</button>
93 93 <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
94 94 </div>
95 95 </div>
... ...
src/main/resources/static/pages/base/company/js/comp-add-form.js
... ... @@ -139,6 +139,8 @@ $(function(){
139 139 });
140 140 // 提交
141 141 function submit() {
  142 + // 防止用户多次提交
  143 + $("#submintBtn").addClass("disabled");
142 144 // 添加数据
143 145 $post('/business', params, function(result) {
144 146 // 如果返回结果不为空
... ... @@ -155,6 +157,7 @@ $(function(){
155 157 // 返回list.html页面
156 158 loadPage('list.html');
157 159 });
  160 + $("#submintBtn").removeClass("disabled");
158 161 }
159 162 }
160 163 });
... ...
src/main/resources/static/pages/base/geo_data_edit/css/mian.css
... ... @@ -80,9 +80,14 @@ div#map_wrap{
80 80 font-size: 14px;
81 81 color: #0aae0a;
82 82 }
83   -._version_dropdown_wrap li.uk-active>a{
  83 +
  84 +a._version_text:hover{
84 85 color: #0aae0a;
85 86 }
  87 +
  88 +._version_dropdown_wrap li.uk-active>a{
  89 + color: blue;
  90 +}
86 91 .uk-nav-header:not(:first-child) {
87 92 margin-top: 10px;
88 93 }
... ... @@ -91,19 +96,43 @@ div#map_wrap{
91 96 right: 18px;
92 97 top: 10px;
93 98 }
  99 +
  100 +.remove_line_version_icon{
  101 + position: absolute;
  102 + right: 46px;
  103 + top: 10px;
  104 +}
  105 +
  106 +a.clock_enable_version,
  107 +a.clock_enable_version:hover,
  108 +a.clock_enable_version:active,
  109 +a.clock_enable_version:focus{
  110 + color: #ef4f4f;
  111 +}
  112 +
94 113 .clock_enable_version{
95   - padding: 4px 0 0 15px;
96   - font-size: 13px;
  114 + padding: 6px 0 0 13px;
  115 + font-size: 12px;
  116 + color: #ef4f4f;
  117 + overflow: hidden;
  118 + text-overflow: ellipsis;
  119 + white-space: nowrap;
  120 + display: block;
  121 +}
  122 +
  123 +.clock_enable_version .t_t_str{
  124 + font-size: 15px;
97 125 color: #ef4f4f;
98 126 }
99 127  
100 128 .clock_enable_version>a.uk-icon{
101 129 vertical-align: top;
102   - margin-top: 6px;
  130 + margin-top: 5px;
103 131 }
104 132 ._route_info_wrap{
105 133 height: calc(100% - 90px);
106 134 padding-top: 10px;
  135 + background: #fff;
107 136 }
108 137  
109 138 ._route_info_wrap .uk-tab>li>a{
... ... @@ -606,10 +635,110 @@ ul.context-menu-list.station-route-ct-menu.context-menu-root {
606 635 pointer-events: auto;
607 636 }
608 637  
609   -#add_line_versions_modal form.uk-form-horizontal .uk-form-label{
  638 +.lvm_wrap form.uk-form-horizontal .uk-form-label{
610 639 width: 100px !important;
611 640 }
612 641  
613   -#add_line_versions_modal form.uk-form-horizontal .uk-form-controls{
  642 +.lvm_wrap form.uk-form-horizontal .uk-form-controls{
614 643 margin-left: 115px;
615   -}
616 644 \ No newline at end of file
  645 +}
  646 +
  647 +.rt_show_version_txt{
  648 + display: none;
  649 +}
  650 +
  651 +.empty_add_icon{
  652 + width: 140px;
  653 + border: 1px dashed #e2e2e2 !important;
  654 + text-align: center;
  655 + padding: 5px 0;
  656 + margin-left: 57px;
  657 + cursor: pointer;
  658 +}
  659 +
  660 +.empty_add_icon:hover{
  661 + border: 1px solid #e2e2e2;
  662 +}
  663 +
  664 +.empty_add_icon>span.uk-icon{
  665 + vertical-align: top;
  666 + margin-top: 3px;
  667 +}
  668 +
  669 +.empty_add_icon>a{
  670 + color: grey !important;
  671 + display: inline-block !important;
  672 + width: auto !important;
  673 + padding-left: 0 !important;
  674 +}
  675 +
  676 +.road_route>ul.empty{
  677 + border-left: none;
  678 +}
  679 +
  680 +.s_future_version_info ._line_info{
  681 + height: 95px;
  682 +}
  683 +
  684 +.s_future_version_info ._route_info_wrap{
  685 + height: calc(100% - 105px);
  686 + background: #fff;
  687 +}
  688 +
  689 +a.b_l_s_link{
  690 + color: red;
  691 + font-size: 13px;
  692 + display: inline-block;
  693 + vertical-align: bottom;
  694 + margin-right: 5px;
  695 +}
  696 +
  697 +.clock_enable_version.green,
  698 +.clock_enable_version.green:hover,
  699 +.clock_enable_version.green:active,
  700 +.clock_enable_version.green:focus{
  701 + color: green;
  702 +}
  703 +
  704 +.clock_enable_version.green .t_t_str{
  705 + color: green !important;
  706 +}
  707 +
  708 +
  709 +.clock_enable_version.orange,
  710 +.clock_enable_version.orange:hover,
  711 +.clock_enable_version.orange:active,
  712 +.clock_enable_version.orange:focus{
  713 + color: #c88408;
  714 +}
  715 +
  716 +.clock_enable_version.orange .t_t_str{
  717 + color: #c88408 !important;
  718 +}
  719 +
  720 +._version_text.e0{
  721 + color: grey !important;
  722 +}
  723 +
  724 +._version_text.e2{
  725 + color: #c88408 !important;
  726 +}
  727 +
  728 +.uk-tooltip.uk-active {
  729 + z-index: 99999;
  730 +}
  731 +
  732 +div[id*='PanoramaFlashWraperTANGRAM']{
  733 + z-index: 99999;
  734 + background: #fff;
  735 + text-align: center;
  736 + color: red;
  737 +}
  738 +/*
  739 +div[id*='PanoramaFlashWraperTANGRAM']:before{
  740 + content: "如果你使用的是chrome浏览器,请在设置里允许当前页面IP启用flash";
  741 + position: absolute;
  742 + top: 50px;
  743 + left: calc(50% - 220px);
  744 + font-size: 18px;
  745 +}*/
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/f_road_route.html
1 1 <div>
2 2 <script id="geo_d_e_road_route-temp" type="text/html">
3   - <ul class="uk-list">
  3 + <ul class="uk-list {{if list.length==0}}empty{{/if}}">
4 4 {{each list as subArr i}}
5 5 <li class="r_r_item f_r_a" data-id="{{subArr[0].id}}" data-code="{{subArr[0].sectionCode}}">
6 6 <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a>
... ... @@ -17,6 +17,15 @@
17 17 {{/if}}
18 18 </li>
19 19 {{/each}}
  20 +
  21 + {{if list.length==0}}
  22 + <li class="r_r_item">
  23 + <div class="empty_add_icon add_road_icon" data-updown="{{updown}}">
  24 + <span uk-icon="icon: plus;ratio:.8"></span>
  25 + <a>添加路段</a>
  26 + </div>
  27 + </li>
  28 + {{/if}}
20 29 </ul>
21 30 </script>
22 31  
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html
... ... @@ -10,6 +10,15 @@
10 10 <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a>
11 11 </li>
12 12 {{/each}}
  13 +
  14 + {{if list.length==0}}
  15 + <li class="">
  16 + <div class="empty_add_icon add_station_icon">
  17 + <span uk-icon="icon: plus;ratio:.8"></span>
  18 + <a data-updown="{{updown}}">添加站点</a>
  19 + </div>
  20 + </li>
  21 + {{/if}}
13 22 </ul>
14 23 </script>
15 24  
... ... @@ -54,7 +63,7 @@
54 63 半径:{{radius}}
55 64 {{/if}}
56 65 </li>
57   - <li>站序:{{index + 1}}</li>
  66 + <li>站序:{{index}}</li>
58 67 <li>路由序号:{{stationRouteCode}}</li>
59 68 </ul>
60 69 </script>
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/versions.html
1 1 <div>
  2 + <script id="geo_d_e_version_dropdown-temp" type="text/html">
  3 + {{if data[0]!=null}}
  4 + <li class="uk-nav-header">历史</li>
  5 + {{each data[0] as obj i}}
  6 + <li class="{{if obj.versions==cvs}}uk-active{{/if}} e0" data-version="{{obj.versions}}"><a>{{obj.name}}</a></li>
  7 + {{/each}}
  8 + <li class="uk-nav-divider"></li>
  9 + {{/if}}
  10 +
  11 + {{if data[1]!=null}}
  12 + <li class="uk-nav-header">启用的</li>
  13 + {{each data[1] as obj i}}
  14 + <li class="{{if obj.versions==cvs}}uk-active{{/if}} e1" data-version="{{obj.versions}}"><a>{{obj.name}}</a></li>
  15 + {{/each}}
  16 + {{/if}}
  17 +
  18 + {{if data[2]!=null}}
  19 + <li class="uk-nav-header">未来</li>
  20 + {{each data[2] as obj i}}
  21 + <li class="{{if obj.versions==cvs}}uk-active{{/if}} e2" data-version="{{obj.versions}}"><a>{{obj.name}}</a></li>
  22 + {{/each}}
  23 + {{/if}}
  24 + </script>
  25 +
2 26 <script id="geo_d_e_version_add-temp" type="text/html">
3   - <div id="add_line_versions_modal" uk-modal esc-close="false" bg-close="false">
  27 + <div id="add_line_versions_modal" uk-modal esc-close="false" bg-close="false" class="lvm_wrap">
4 28 <div class="uk-modal-dialog uk-modal-body">
5 29 <button class="uk-modal-close-default" type="button" uk-close></button>
6 30 <h2 class="uk-modal-title">添加走向版本</h2>
... ... @@ -11,6 +35,8 @@
11 35 <div class="uk-form-controls">
12 36 <select class="uk-select" name="remark">
13 37 <option>线路改道</option>
  38 + <option>增加中途站</option>
  39 + <option>站名更变</option>
14 40 <option>其他</option>
15 41 </select>
16 42 </div>
... ... @@ -19,7 +45,7 @@
19 45 <div class="uk-margin">
20 46 <label class="uk-form-label" >启用时间</label>
21 47 <div class="uk-form-controls">
22   - <input class="uk-input _flatpickr" type="text" name="startDate" placeholder="启用该版本走向的时间">
  48 + <input class="uk-input _flatpickr" type="text" name="startDate" placeholder="启用这个走向的时间">
23 49 </div>
24 50 </div>
25 51  
... ... @@ -33,11 +59,11 @@
33 59 <div class="uk-margin">
34 60 <div class="uk-form-label">继承走向</div>
35 61 <div class="uk-form-controls">
36   - <select class="uk-select" >
37   - <option>不继承之前的走向</option>
  62 + <select class="uk-select" name="extendsVersion">
  63 + <option value="-1">不继承之前的走向</option>
38 64  
39 65 {{each array as obj i}}
40   - <option data-id="{{obj.id}}" data-versions="{{obj.versions}}">{{obj.name}}</option>
  66 + <option value="{{obj.versions}}" data-id="{{obj.id}}">{{obj.name}}</option>
41 67 {{/each}}
42 68 </select>
43 69 </div>
... ... @@ -52,4 +78,80 @@
52 78 </div>
53 79 </div>
54 80 </script>
  81 +
  82 + <script id="geo_d_e_version_enable-temp" type="text/html">
  83 + <div id="enable_line_versions_modal" uk-modal esc-close="false" bg-close="false" class="lvm_wrap">
  84 + <div class="uk-modal-dialog uk-modal-body">
  85 + <button class="uk-modal-close-default" type="button" uk-close></button>
  86 + <h2 class="uk-modal-title">启用版本({{name}})</h2>
  87 +
  88 + <form class="uk-form-horizontal uk-margin-large">
  89 + <div class="uk-margin">
  90 + <label class="uk-form-label" >版本名称</label>
  91 + <div class="uk-form-controls">
  92 + <input class="uk-input" type="text" name="name" value="{{name}}" readonly>
  93 + </div>
  94 + </div>
  95 +
  96 + <div class="uk-margin">
  97 + <label class="uk-form-label" >版本号</label>
  98 + <div class="uk-form-controls">
  99 + <input class="uk-input" type="text" name="versions" value="{{versions}}" readonly>
  100 + </div>
  101 + </div>
  102 +
  103 + <div class="uk-margin">
  104 + <label class="uk-form-label" >启用时间</label>
  105 + <div class="uk-form-controls">
  106 + <input class="uk-input _flatpickr" type="text" name="startDate" placeholder="启用该版本走向的时间">
  107 + </div>
  108 + </div>
  109 + </form>
  110 +
  111 + <p class="uk-text-right">
  112 + <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button>
  113 + <button class="uk-button uk-button-primary _submit" type="button">提交</button>
  114 + </p>
  115 + </div>
  116 + </div>
  117 + </script>
  118 +
  119 + <script id="g_d_e_v_enable_edit-temp" type="text/html">
  120 + <div id="enable_versions_edit_modal" uk-modal esc-close="false" bg-close="false" class="lvm_wrap">
  121 + <div class="uk-modal-dialog uk-modal-body">
  122 + <button class="uk-modal-close-default" type="button" uk-close></button>
  123 + <h2 class="uk-modal-title">待更新版本</h2>
  124 +
  125 + <form class="uk-form-horizontal uk-margin-large">
  126 + <div class="uk-margin">
  127 + <label class="uk-form-label" >启用时间</label>
  128 + <div class="uk-form-controls">
  129 + <input class="uk-input _flatpickr" type="text" name="startDate" value="{{start_date_str}}">
  130 + </div>
  131 + </div>
  132 +
  133 + <div class="uk-margin">
  134 + <label class="uk-form-label" >版本名称</label>
  135 + <div class="uk-form-controls">
  136 + <input class="uk-input" type="text" name="name" value="{{name}}" readonly>
  137 + </div>
  138 + </div>
  139 +
  140 + <div class="uk-margin">
  141 + <label class="uk-form-label" >版本号</label>
  142 + <div class="uk-form-controls">
  143 + <input class="uk-input" type="text" name="versions" value="{{versions}}" readonly>
  144 + </div>
  145 + </div>
  146 + </form>
  147 +
  148 + <p class="uk-text-right">
  149 + <a class="b_l_s_link" title="日后再说" uk-tooltip="pos:top">撤销启用计划</a>
  150 + <button class="uk-button uk-button-default uk-modal-close" type="button">取消</button>
  151 + <!--<button class="uk-button uk-button-danger _cancel" type="button">撤销</button>-->
  152 + <button class="uk-button uk-button-primary _submit" type="button">提交</button>
  153 + </p>
  154 + </div>
  155 + </div>
  156 + </script>
55 157 </div>
56 158 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/ct_common.js 0 → 100644
  1 +var gb_common = (function () {
  2 +
  3 + var flatpickrDateTimeConfig = {
  4 + enableTime: true,
  5 + time_24hr: true,
  6 + "locale": "zh",
  7 + onOpen: function () {
  8 + $(this.calendarContainer).addClass('showTimeInput');
  9 + }
  10 + };
  11 +
  12 + var groupBy = function (list, field) {
  13 + var rs = {},
  14 + key;
  15 + $.each(list, function () {
  16 + key = this[field];
  17 + if (!rs[key])
  18 + rs[key] = [];
  19 +
  20 + rs[key].push(this);
  21 + });
  22 +
  23 + return rs;
  24 + };
  25 +
  26 + var compileTempByDom = function (dom, opts) {
  27 + var tps = {},
  28 + id;
  29 + $('script[type="text/html"]', dom).each(function () {
  30 + id = $(this).attr('id');
  31 + if (id)
  32 + tps[id] = template.compile($(this).html(), opts);
  33 + });
  34 + return tps;
  35 + };
  36 +
  37 + var $get = function (url, data, successFun) {
  38 + $.ajax({
  39 + url: url,
  40 + data: data,
  41 + complete: function (xhr, ts) {
  42 + ajaxComplete(xhr, ts, successFun);
  43 + }
  44 + });
  45 + };
  46 +
  47 + var $post = function (url, data, successFun) {
  48 + $.ajax({
  49 + url: url,
  50 + method: 'POST',
  51 + data: data,
  52 + complete: function (xhr, ts) {
  53 + ajaxComplete(xhr, ts, successFun);
  54 + }
  55 + });
  56 + };
  57 +
  58 + var $post_arr = function (url, data, successFun) {
  59 + $.ajax({
  60 + url: url,
  61 + method: 'POST',
  62 + traditional: true,
  63 + data: data,
  64 + complete: function (xhr, ts) {
  65 + ajaxComplete(xhr, ts, successFun);
  66 + }
  67 + });
  68 + };
  69 +
  70 + var $del = function (url, successFun) {
  71 + $post(url, {'_method': 'delete'}, function (rs) {
  72 + successFun && successFun(rs);
  73 + });
  74 + };
  75 +
  76 + function hide_wait_modal() {
  77 + $('.main_left_panel_m_layer').hide();
  78 + $loadPanel.hide();
  79 + //gb_ct_map.resetMapStatus();
  80 + }
  81 +
  82 + var errorHead = '<span style="color:red;">异常:</span>';
  83 +
  84 + function successHandle(json, handle) {
  85 + var status = json.status;
  86 + if (status == 407) {
  87 + location.href = '/login.html';
  88 + return;
  89 + }
  90 +
  91 + if (!status) {
  92 + handle && handle(json);
  93 + return;
  94 + }
  95 +
  96 + if (status == 'ERROR'){
  97 + UIkit.modal.alert(errorHead + (json.msg ? json.msg : '未知异常'), {labels: {Ok: '确定'}});
  98 + //关闭wait窗口
  99 + hide_wait_modal();
  100 + }
  101 + else
  102 + handle && handle(json);
  103 + }
  104 +
  105 + function ajaxComplete(xhr, ts, succ) {
  106 + if (ts == 'success') {
  107 + successHandle(JSON.parse(xhr.responseText), succ);
  108 + } else if (ts == 'error') {
  109 + UIkit.modal.alert(errorHead + xhr.responseText, {labels: {Ok: '确定'}});
  110 + //关闭wait窗口
  111 + hide_wait_modal();
  112 + }
  113 + }
  114 +
  115 + var get_vals = function (json) {
  116 + var array = [];
  117 + for (var key in json) {
  118 + array.push(json[key]);
  119 + }
  120 +
  121 + return array;
  122 + };
  123 +
  124 + var get_keys = function (json) {
  125 + var array = [];
  126 + for (var key in json) {
  127 + array.push(key);
  128 + }
  129 + return array;
  130 + };
  131 +
  132 + var accAdd = function (a, b) {
  133 + var c, d, e;
  134 + try {
  135 + c = a.toString().split(".")[1].length;
  136 + } catch (f) {
  137 + c = 0;
  138 + }
  139 + try {
  140 + d = b.toString().split(".")[1].length;
  141 + } catch (f) {
  142 + d = 0;
  143 + }
  144 + return e = Math.pow(10, Math.max(c, d)), (mul(a, e) + mul(b, e)) / e;
  145 + };
  146 +
  147 + function accDiv(arg1,arg2){
  148 + var t1=0,t2=0,r1,r2;
  149 + try{t1=arg1.toString().split(".")[1].length}catch(e){}
  150 + try{t2=arg2.toString().split(".")[1].length}catch(e){}
  151 + with(Math){
  152 + r1=Number(arg1.toString().replace(".",""))
  153 + r2=Number(arg2.toString().replace(".",""))
  154 + return (r1/r2)*pow(10,t2-t1);
  155 + }
  156 + }
  157 +
  158 + function mul(a, b) {
  159 + var c = 0,
  160 + d = a.toString(),
  161 + e = b.toString();
  162 + try {
  163 + c += d.split(".")[1].length;
  164 + } catch (f) {
  165 + }
  166 + try {
  167 + c += e.split(".")[1].length;
  168 + } catch (f) {
  169 + }
  170 + return Number(d.replace(".", "")) * Number(e.replace(".", "")) / Math.pow(10, c);
  171 + }
  172 +
  173 + var numSubtr = function (a, b) {
  174 + var c, d, e;
  175 + try {
  176 + c = a.toString().split(".")[1].length;
  177 + } catch (f) {
  178 + c = 0;
  179 + }
  180 + try {
  181 + d = b.toString().split(".")[1].length;
  182 + } catch (f) {
  183 + d = 0;
  184 + }
  185 + return e = Math.pow(10, Math.max(c, d)), (a * e - b * e) / e;
  186 + };
  187 +
  188 + var trim = function (str, is_global) {
  189 + var result;
  190 + result = str.replace(/(^\s+)|(\s+$)/g, "");
  191 + if (is_global.toLowerCase() == "g") {
  192 + result = result.replace(/\s/g, "");
  193 + }
  194 + return result;
  195 + };
  196 +
  197 + var inverse = function (map) {
  198 + var rs = {};
  199 + for(var k in map){
  200 + rs[map[k]] = k;
  201 + }
  202 +
  203 + return rs;
  204 + };
  205 +
  206 + var next_elem = function (clazz, e) {
  207 + var ne = e.next();
  208 + if(ne.length==0)
  209 + return [];
  210 + else if(ne.hasClass(clazz))
  211 + return ne;
  212 + else
  213 + return next_elem(clazz, ne);
  214 + };
  215 +
  216 + var getDisabledVal = function (f) {
  217 + var rs = {};
  218 + $('input,select', f).each(function () {
  219 + if($(this).attr('disabled')){
  220 + rs[$(this).attr('name')]=$(this).val();
  221 + }
  222 + });
  223 + return rs;
  224 + };
  225 +
  226 + return {
  227 + groupBy: groupBy,
  228 + compileTempByDom: compileTempByDom,
  229 + $get: $get,
  230 + $post: $post,
  231 + $post_arr: $post_arr,
  232 + $del: $del,
  233 + get_vals: get_vals,
  234 + get_keys: get_keys,
  235 + accAdd: accAdd,
  236 + numSubtr: numSubtr,
  237 + trim: trim,
  238 + flatpickrDateTimeConfig: flatpickrDateTimeConfig,
  239 + inverse: inverse,
  240 + accDiv: accDiv,
  241 + mul: mul,
  242 + next_elem: next_elem,
  243 + getDisabledVal: getDisabledVal,
  244 + };
  245 +})();
... ...
src/main/resources/static/pages/base/geo_data_edit/js/map.js
... ... @@ -2,6 +2,8 @@
2 2  
3 3 var gb_ct_map = function () {
4 4  
  5 + var initFlag;
  6 +
5 7 //初始化地图
6 8 if (!window.BMap) {
7 9 alert('地图没有加载成功,请确认是否能正常连接外网!!');
... ... @@ -42,7 +44,7 @@ var gb_ct_map = function () {
42 44 stCtrl.setOffset(new BMap.Size(20, 20));
43 45 map.addControl(stCtrl);//添加全景控件
44 46  
45   - var roadPolylines = [], stationMarkers = [];
  47 + var roadPolylines = {0:[],1:[]}, stationMarkers = {0:[],1:[]};
46 48 var _render = function (cb) {
47 49 //绘制路段
48 50 _renderRoads(gb_road_route.getData());
... ... @@ -52,9 +54,15 @@ var gb_ct_map = function () {
52 54 changeUpDown();
53 55  
54 56 //居中至上行中间站点
55   - var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];
56   - map.setCenter(cm.point);
  57 + if(!initFlag){
  58 + if(stationMarkers[0].length>0){
  59 + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];
  60 + map.setCenter(cm.point);
  61 + }
  62 + initFlag=true;
  63 + }
57 64  
  65 + $('.BMap_noprint.anchorTR').attr('title', '部分浏览器可能需要允许当前页面ip启用flash');
58 66 cb && cb();
59 67 };
60 68  
... ... @@ -62,20 +70,25 @@ var gb_ct_map = function () {
62 70 return updown == 0 ? 'blue' : 'red';
63 71 };
64 72 var _renderRoads = function (data) {
65   - _renderPolyline(data[0], updownColor(0));//上行路段
66   - _renderPolyline(data[1], updownColor(1));//下行路段
  73 + if(data[0])
  74 + _renderPolyline(data[0], updownColor(0));//上行路段
  75 + if(data[1])
  76 + _renderPolyline(data[1], updownColor(1));//下行路段
67 77 };
68 78  
69 79 var _renderStation = function (data) {
70   - _renderStationMarket(data[0]);//上行站点
71   - _renderStationMarket(data[1]);//下行站点
  80 + if(data[0])
  81 + _renderStationMarket(data[0]);//上行站点
  82 + if(data[1])
  83 + _renderStationMarket(data[1]);//下行站点
72 84 };
73 85  
74 86 var _renderStationMarket = function (routes, color) {
  87 + if(routes.length==0)
  88 + return;
75 89 var marker;
76 90 var array = [];
77 91 $.each(routes, function (i) {
78   - this.index = i;
79 92 transCoord(this);
80 93 marker = createStationMark(this);
81 94 marker.stationCode = this.stationCode;
... ... @@ -96,6 +109,8 @@ var gb_ct_map = function () {
96 109 }
97 110  
98 111 var _renderPolyline = function (routes, color) {
  112 + if(routes.length==0)
  113 + return;
99 114 var pos, temps;
100 115 var polyline, _pLines = [];
101 116 var style = {strokeWeight: 7, strokeColor: color, strokeOpacity: .7};
... ... @@ -228,8 +243,8 @@ var gb_ct_map = function () {
228 243 ctx.fillStyle = '#fff';
229 244  
230 245 var i = station.index;
231   - if(!isNaN(i))
232   - i ++;
  246 + /* if(!isNaN(i))
  247 + i ++;*/
233 248 var left = (i + '').length > 1 ? 3 : 7;
234 249 ctx.fillText(i, left, 14);
235 250  
... ... @@ -275,6 +290,8 @@ var gb_ct_map = function () {
275 290 if (marker) {
276 291 openStationInfoWin(marker);
277 292 }
  293 + //居中
  294 + map.setCenter(marker.point);
278 295 };
279 296  
280 297 var getStationMarker = function (code, updown) {
... ... @@ -548,7 +565,7 @@ var gb_ct_map = function () {
548 565  
549 566 var point;
550 567 var pId = gb_road_route.getAddPrevId();
551   - if(pId){
  568 + if(pId && pId !=-1){
552 569 //从上一个路段继续绘制
553 570 var prev = gb_road_route.getRoadById(pId),
554 571 coords = prev.bdCoords,
... ... @@ -598,7 +615,7 @@ var gb_ct_map = function () {
598 615 var point;
599 616 if(!pos || pos.length==0){
600 617 var pId = gb_station_route.getAddPrevId();
601   - if(pId){
  618 + if(pId && pId!=-1){
602 619 //百度没有定位到位置,默认靠近在上一个站
603 620 var prev = gb_station_route.getStationById(pId);
604 621 point = new BMap.Point(prev.bd_lon - 0.0001, prev.bd_lat - 0.0001);
... ... @@ -691,6 +708,7 @@ var gb_ct_map = function () {
691 708 * @param upDown
692 709 */
693 710 var reDrawStation = function (upDown) {
  711 + map_status = 0;
694 712 $.each(stationMarkers[upDown], function () {
695 713 map.removeOverlay(this);
696 714 });
... ... @@ -843,6 +861,17 @@ var gb_ct_map = function () {
843 861 showAddRoadPanel: showAddRoadPanel,
844 862 map: map,
845 863 focus: focusPoint,
846   - clearfocus: clearfocus
  864 + clearfocus: clearfocus,
  865 + clearAll: function () {
  866 + map_status = 0;
  867 + roadPolylines = {0:[],1:[]};
  868 + stationMarkers = {0:[],1:[]};
  869 + editCircle = null;
  870 + editPolygon = null;
  871 + dragMarker = null;
  872 +
  873 + map.clearOverlays();
  874 +
  875 + }
847 876 };
848 877 }();
849 878 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js
... ... @@ -11,20 +11,25 @@ var gb_road_route = function () {
11 11 road_maps = data;
12 12 temps = temp;
13 13  
14   - //按顺序,名称分组
15   - var ups = _group(road_maps[0]);
16   - var downs = _group(road_maps[1]);
17 14 //渲染
18   - var upHtmlStr = temps['geo_d_e_road_route-temp']({list: ups});
19   - $('.up_down_route_list>li:first>.road_route').html(upHtmlStr);
20   - var downHtmlStr = temps['geo_d_e_road_route-temp']({list: downs});
21   - $('.up_down_route_list>li:last>.road_route').html(downHtmlStr);
  15 + if(road_maps[0]){
  16 + var ups = _group(road_maps[0]);
  17 + var upHtmlStr = temps['geo_d_e_road_route-temp']({list: ups, updown: 0});
  18 + $('.up_down_route_list>li:first>.road_route').html(upHtmlStr);
  19 + }
  20 +
  21 + if(road_maps[1]){
  22 + var downs = _group(road_maps[1]);
  23 + var downHtmlStr = temps['geo_d_e_road_route-temp']({list: downs, updown: 1});
  24 + $('.up_down_route_list>li:last>.road_route').html(downHtmlStr);
  25 + }
22 26  
23 27 cb && cb();
24 28 });
25 29  
26 30 //加载数据
27   - gb_common.$get('/_geo_data/findGeoRoad', {lineCode: lineCode}, function (rs) {
  31 + var version = storage.getItem("geo_data_edit_line_version");
  32 + gb_common.$get('/_geo_data/findGeoRoad', {lineCode: lineCode,version:version}, function (rs) {
28 33 rs.list.sort(function (a, b) {
29 34 return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode);
30 35 });
... ... @@ -35,7 +40,10 @@ var gb_road_route = function () {
35 40 this.cp = geolib.getCenter(_pos);
36 41 this.len = geolib.getPathLength(_pos);
37 42 });
38   - ep.emit('data', gb_common.groupBy(rs.list, 'directions'));
  43 + var data = {0:[],1:[]};
  44 + if(rs.list.length > 0)
  45 + data = gb_common.groupBy(rs.list, 'directions');
  46 + ep.emit('data', data);
39 47 });
40 48  
41 49 //加载模板片段
... ... @@ -67,6 +75,9 @@ var gb_road_route = function () {
67 75 tempArr.push(obj);
68 76 name = obj.sectionName
69 77 }
  78 +
  79 + if(tempArr.length > 0)
  80 + rs.push(tempArr);
70 81 return rs;
71 82 };
72 83  
... ... @@ -126,7 +137,8 @@ var gb_road_route = function () {
126 137  
127 138 var addPrevId;//添加路段路由的上一个路由ID
128 139 var insert_road_before = function (road) {
129   - isPrevEnd(road);
  140 + if(!isPrevEnd(road))
  141 + return;
130 142  
131 143 //在之前插入路段
132 144 var cell = getRoadLI(road);
... ... @@ -138,16 +150,30 @@ var gb_road_route = function () {
138 150 add_road(addCell);
139 151 };
140 152  
  153 + /**
  154 + *
  155 + * 路段添加按钮
  156 + */
  157 + $(document).on('click', '.add_road_icon', function () {
  158 + var cell = $(this);
  159 +
  160 + if(!isPrevEnd({directions: cell.data('updown')}))
  161 + return;
  162 +
  163 + var addCell = $(temps['geo_d_e_add_road_panel-temp']({sectionName: '', crosesRoad: ''}));
  164 + cell.after(addCell);
  165 + add_road(addCell);
  166 + });
  167 +
141 168 var insert_road_after = function (road) {
142   - isPrevEnd(road);
  169 + if(!isPrevEnd(road))
  170 + return;
143 171  
144 172 //在之后插入路段
145 173 var cell = getRoadLI(road);
146 174  
147 175 var addCell = $(temps['geo_d_e_add_road_panel-temp'](road));
148 176  
149   - //var next = cell.next('.r_r_item');
150   - //cell.after(addCell);
151 177 var $bksList = $('.bks_list', cell);
152 178 if($bksList.length > 0)
153 179 $bksList.prepend(addCell);
... ... @@ -157,8 +183,11 @@ var gb_road_route = function () {
157 183 };
158 184  
159 185 var isPrevEnd = function (r) {
160   - if($('.up_down_route_list>li:eq('+r.directions+')>.road_route .road_li_transient').length > 0)
161   - return UIkit.notification("你需要完成上一个路段新增!", {status: 'danger'});
  186 + if($('.up_down_route_list>li:eq('+r.directions+')>.road_route .road_li_transient').length > 0) {
  187 + UIkit.notification("你需要完成上一个路段新增!", {status: 'danger'});
  188 + return false;
  189 + }
  190 + return true;
162 191 };
163 192  
164 193 var add_road = function (cell) {
... ... @@ -281,7 +310,7 @@ var gb_road_route = function () {
281 310 };
282 311  
283 312 var updateList = function (list) {
284   - var updown = list[0].directions;
  313 + var updown = getUpDown();
285 314 list.sort(function (a, b) {
286 315 return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode);
287 316 });
... ... @@ -333,6 +362,15 @@ var gb_road_route = function () {
333 362 }
334 363 });
335 364  
  365 + //取消
  366 + $('button.cancel', spp).on('click', function () {
  367 + $('.main_left_panel_m_layer').hide();
  368 + $(this).parents('.buffer_edit_body').parent().remove();
  369 + gb_ct_map.resetMapStatus();
  370 + //debugger
  371 + //gb_ct_map.exitEditRoadStatus(road);
  372 + });
  373 +
336 374 gb_ct_map.showAddRoadPanel(name, cName);
337 375 };
338 376  
... ...
src/main/resources/static/pages/base/geo_data_edit/js/search.js
... ... @@ -27,7 +27,8 @@ var gb_ct_search = function () {
27 27 });
28 28  
29 29 var searchComplete = function (e) {
30   - var htmlStr = template('geo_d_e_search_result-temp', {list: e.wr});
  30 + //console.log('e.wr', e);
  31 + var htmlStr = template('geo_d_e_search_result-temp', {list: e.yr});
31 32 $('.ct_search_result').html(htmlStr);
32 33  
33 34 };
... ...
src/main/resources/static/pages/base/geo_data_edit/js/server_timer.js 0 → 100644
  1 +/**
  2 + * 服务器时间
  3 + * @type {{}}
  4 + */
  5 +var gb_second_timer = (function () {
  6 +
  7 + var now;
  8 + //var _this;
  9 + var secondTimer;
  10 + //var contextFlag;
  11 +
  12 + var setVersionEnableTimeFun;
  13 +
  14 + var init = function () {
  15 + //_this = $('.clock_enable_version .t_t_str')[0];
  16 + getServerTime(function (time) {
  17 + now = time;
  18 + /*$('div.north').bind("contextmenu", function () {
  19 + contextFlag = true;
  20 + });*/
  21 + //setTime();
  22 +
  23 + secondTimer = window.setInterval(function () {
  24 + if (0 == now.getSeconds()) {
  25 + minuteTimer();
  26 + //contextFlag = false;
  27 + }
  28 +
  29 + now = new Date(now.getTime() + 1e3);
  30 + //setTime();
  31 + setVersionEnableTimeFun && setVersionEnableTimeFun(now);
  32 + }, 1e3);
  33 + });
  34 + };
  35 +
  36 + var getServerTime = function (callback) {
  37 + function oncallback(jqXHR) {
  38 + var time = jqXHR && jqXHR.getResponseHeader("Date");
  39 + if (time)
  40 + callback(new Date(time))
  41 + }
  42 +
  43 + if ("function" == typeof callback)
  44 + $.ajax({
  45 + url: "/real_control_v2/assets/imgs/time.gif",
  46 + type: "HEAD"
  47 + }).done(function (data, textStatus, jqXHR) {
  48 + oncallback(jqXHR)
  49 + }).fail(function (jqXHR, textStatus, errorThrown) {
  50 + oncallback(jqXHR)
  51 + })
  52 + };
  53 +
  54 +/* var timeFormat = function (str) {
  55 + return ("0" + str).slice(-2)
  56 + };*/
  57 +
  58 + /* var setTime = function () {
  59 + _this.innerHTML = timeFormat(now.getHours()) + ':' + timeFormat(now.getMinutes()) + '.' + timeFormat(now.getSeconds());
  60 + };*/
  61 +
  62 + var minuteTimer = function () {
  63 + getServerTime(function (time) {
  64 + now = time;
  65 + //setTime()
  66 + })
  67 + };
  68 +
  69 + window.setTimeout(init, 1000);
  70 +
  71 + return {
  72 + now: function () {
  73 + return now;
  74 + },
  75 + initSetVersionEnableTimeFun: function (fun) {
  76 + setVersionEnableTimeFun = fun;
  77 + },
  78 + removeVersionEnableTimeFun: function () {
  79 + setVersionEnableTimeFun = null;
  80 + }
  81 + }
  82 +})();
0 83 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js
... ... @@ -10,23 +10,52 @@ var gb_station_route = function () {
10 10 var ep = EventProxy.create("data", "temp", function (data, temp) {
11 11 station_maps = data;
12 12 temps = temp;
13   - //当前使用的线路版本
14   - storage.setItem("geo_data_edit_line_version" , data[0][0].versions);
  13 +
15 14 //渲染页面
16   - var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]});
  15 + if(!station_maps[0])
  16 + station_maps[0] = [];
  17 + var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0],updown:0});
17 18 $('.up_down_route_list>li:first>.station_route').html(upHtmlStr);
18   - var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]});
  19 +
  20 + if(!station_maps[1])
  21 + station_maps[1] = [];
  22 + var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1],updown:1});
19 23 $('.up_down_route_list>li:last>.station_route').html(downHtmlStr);
20 24  
21 25 cb && cb();
22 26 });
23 27  
  28 + var version = storage.getItem("geo_data_edit_line_version");
24 29 //加载数据
25   - gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode}, function (rs) {
  30 + gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode, version: version}, function (rs) {
26 31 rs.list.sort(function (a, b) {
27 32 return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode);
28 33 });
29   - ep.emit('data', gb_common.groupBy(rs.list, 'directions'));
  34 +
  35 + //线路当前启用的线路版本
  36 + storage.setItem("geo_data_enable_version" , rs['currentVersion']);
  37 + //当前编辑的线路版本
  38 + storage.setItem("geo_data_edit_line_version" , rs['editVersion']);
  39 +
  40 + var data = {0:[],1:[]};
  41 + if(rs.list.length > 0)
  42 + data = gb_common.groupBy(rs.list, 'directions');
  43 +
  44 + //序号
  45 + if(data[0]){
  46 + for(var i=0,len=data[0].length;i<len;i++){
  47 + data[0][i].index = i + 1;
  48 + }
  49 + }
  50 + if(data[1]){
  51 + for(var i=0,len=data[1].length;i<len;i++){
  52 + data[1][i].index = i + 1;
  53 + }
  54 + }
  55 + /*for(var i=0,len=rs.list.length;i<len;i++){
  56 + rs.list[i].index = i + 1;
  57 + }*/
  58 + ep.emit('data', data);
30 59 });
31 60  
32 61 //加载模板片段
... ... @@ -140,7 +169,6 @@ var gb_station_route = function () {
140 169 if(is_duplication(name))
141 170 return UIkit.notification("站点路由名称重复!!", {status: 'danger'});
142 171  
143   - debugger
144 172 //上一个站点的ID
145 173 var _cell = $(this).parents('.station_li_transient');
146 174 var $prev = prevs(_cell, 's_r_item')
... ... @@ -166,13 +194,14 @@ var gb_station_route = function () {
166 194 prev = $(that).prev();
167 195  
168 196 if(prev.length == 0)
169   - return null;
  197 + return [];
170 198  
171 199 if(prev.hasClass(clazz))
172 200 return prev;
173 201  
174 202 that = prev;
175 203 }
  204 + return [];
176 205 };
177 206  
178 207 /**
... ... @@ -242,6 +271,19 @@ var gb_station_route = function () {
242 271 }
243 272 });
244 273  
  274 + /**
  275 + * 新线路 添加第一个站点
  276 + */
  277 + $(document).on('click', '.add_station_icon', function () {
  278 + //在之后插入站点
  279 + var cell = $(this).parent();
  280 +
  281 + var addCell = $(temps['geo_d_e_add_station_panel-temp']());
  282 + cell.after(addCell);
  283 +
  284 + add_station(addCell);
  285 + });
  286 +
245 287 var showEditPanel = function (s) {
246 288 var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s);
247 289 $('.ct_page').append(htmlStr);
... ... @@ -289,7 +331,7 @@ var gb_station_route = function () {
289 331 });
290 332  
291 333 //缓冲区编辑 切换绘制模式
292   - $('.draw_polygon_switch', $editWrap).on('input', function (e) {
  334 + $('.draw_polygon_switch', $editWrap).on('click', function (e) {
293 335 var type = $(this).data('type');
294 336 if(type==1){
295 337 //退出绘制状态
... ... @@ -388,12 +430,12 @@ var gb_station_route = function () {
388 430 return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode);
389 431 });
390 432  
391   - var upDown = list[0].directions;
  433 + var upDown = getUpDown();
392 434 var dataMaps = {};
393 435 //更新数据
394   - for(var i=0,s;s=list[i++];){
395   - s.index = i;
396   - dataMaps[s.id] = s;
  436 + for(var i=0,len=list.length;i<len;i++){
  437 + list[i].index = i + 1;
  438 + dataMaps[list[i].id] = list[i];
397 439 }
398 440 station_maps[upDown] = list;
399 441 //更新序号
... ... @@ -429,6 +471,7 @@ var gb_station_route = function () {
429 471  
430 472 $('.main_left_panel_m_layer').hide();
431 473 $('.add_station_search_point_wrap').remove();
  474 + $('.empty_add_icon.add_station_icon', wrap).remove();
432 475 };
433 476  
434 477 /**
... ... @@ -436,6 +479,13 @@ var gb_station_route = function () {
436 479 * @param list
437 480 */
438 481 var destroyEnd = function (list, station) {
  482 + if(list.length==0){
  483 + var updown = getUpDown();
  484 + station_maps[updown] = [];
  485 + var upHtmlStr = temps['geo_d_e_station_route-temp']({list: [],updown:updown});
  486 + $('.up_down_route_list>li:'+(updown==0?'first':'last')+'>.station_route').empty().html(upHtmlStr);
  487 + return;
  488 + }
439 489 //被撤销的
440 490 $('.up_down_route_list .s_r_item[data-id='+station.id+']').remove();
441 491 updateStationRouteData(list);
... ...
src/main/resources/static/pages/base/geo_data_edit/js/submit.js
... ... @@ -155,6 +155,25 @@ var gb_data_submit = function () {
155 155 });
156 156 });
157 157  
  158 + /**
  159 + *
  160 + * 添加线路版本 add_line_versions_modal
  161 + */
  162 + $(document).on('click', '#add_line_versions_modal ._submit', function (e) {
  163 + var f = $('form', '#add_line_versions_modal');
  164 + var data = f.serializeJSON();
  165 + data.lineCode = storage.getItem('geo_data_edit_line_code');
  166 +
  167 + UIkit.modal.confirm('确定线路版本【'+data.name+'】?').then(function() {
  168 + $loadPanel.show();
  169 + gb_common.$post('/_geo_data/addNewLineVersion', data, function (rs) {
  170 + storage.setItem("geo_data_edit_line_version", rs['newVersion']);
  171 + clearAll();
  172 + startup();
  173 + });
  174 + });
  175 + });
  176 +
158 177 var show_run_text = function (t) {
159 178 $('.text', $loadPanel).text(t);
160 179 $loadPanel.show();
... ... @@ -171,6 +190,8 @@ var gb_data_submit = function () {
171 190 */
172 191 var destroyStation = function (station) {
173 192  
  193 + station.bdCoords=null;
  194 + delete station.bdCoords;
174 195 UIkit.modal.confirm('确定撤销站点【'+station.stationName+'】?').then(function() {
175 196 show_run_text('正在撤销...');
176 197  
... ...
src/main/resources/static/pages/base/geo_data_edit/js/version_manage.js
... ... @@ -5,50 +5,170 @@ var gb_version_manage = function () {
5 5 var array;
6 6 var lineName;
7 7 var current;
  8 + var futureInfo;
8 9  
9 10 var temps;
10   - var init = function (cVersion) {
  11 + var init = function (enableVersion) {
11 12 var lineCode = storage.getItem("geo_data_edit_line_code");
  13 +
  14 + var ep = EventProxy.create("data", "temp", function () {
  15 + if(!current){
  16 + alert('异常,无法选中当前线路版本!');
  17 + }
  18 +
  19 + //线路名称
  20 + $('.main_left_panel>._line_info>._line_name>span').text(lineName);
  21 + //当前版本
  22 + $('.main_left_panel ._version_dropdown_wrap>._version_text')
  23 + .html(current.name + '<i uk-icon="icon: chevron-down;ratio:.6"></i>').removeClass('e0 e1 e2').addClass('e' + current.status);
  24 +
  25 +
  26 + //按status 分组
  27 + var data = gb_common.groupBy(array, 'status');
  28 + var htmlStr = temps['geo_d_e_version_dropdown-temp']({data: data, cvs: storage.getItem('geo_data_edit_line_version')});
  29 + $('._version_dropdown_wrap ul.all_version_list').html(htmlStr);
  30 +
  31 +
  32 + /**
  33 + * 展现的不是启用的版本,现在启用icon
  34 + */
  35 + $('.main_rt_tools_panel .t2_enable_icon').remove();
  36 + $('.remove_line_version_icon').hide();
  37 + var v_enable = storage.getItem('geo_data_enable_version');
  38 + var v_edit = storage.getItem('geo_data_edit_line_version');
  39 + if(v_enable != v_edit){
  40 + $('.remove_line_version_icon').show();
  41 + $('.main_rt_tools_panel')
  42 + .prepend('<a data-version="'+v_edit+'" uk-icon="icon: future;ratio: .9" class="_icon t2_enable_icon uk-animation-slide-right-small" title="启用这个走向版本" uk-tooltip="pos:bottom"></a>');
  43 + }
  44 +
  45 + /**
  46 + * 待启用的版本信息
  47 + */
  48 + init_futureInfo(lineCode);
  49 + });
  50 +
12 51 //获取线路版本信息
13   - gb_common.$get('/_geo_data/findVersionInfo', {lineCode: lineCode}, function (rs) {
  52 + gb_common.$get('/_geo_data/findVersionInfo?t='+ Math.random(), {lineCode: lineCode}, function (rs) {
14 53 array = rs.list;
15 54 lineName = array[0].lineName;
16 55  
17 56 //当前使用版本
18 57 for(var i=0,obj;obj=array[i++];){
19   - if(obj.versions==cVersion){
  58 + if(obj.versions==enableVersion){
20 59 current = obj;
21 60 break;
22 61 }
23 62 }
24   -
25   - if(!current){
26   - alert('异常,无法选中当前线路版本!');
27   - }
28   -
29   - //线路名称
30   - $('.main_left_panel>._line_info>._line_name>span').text(lineName);
31   - //当前版本
32   - $('.main_left_panel ._version_dropdown_wrap>._version_text').html(current.name + '<i uk-icon="icon: chevron-down;ratio:.6"></i>');
  63 + ep.emit('data', array);
33 64 });
34 65  
35 66 $.get('/pages/base/geo_data_edit/fragments/versions.html', function (dom) {
36 67 temps = gb_common.compileTempByDom(dom, {
37 68 compress: true
38 69 });
  70 + ep.emit('temp');
  71 + });
  72 + };
  73 +
  74 + var init_futureInfo = function (lineCode) {
  75 + futureInfo = null;
  76 + $('.clock_enable_version').empty();
  77 + $('.main_left_panel').removeClass('s_future_version_info');
  78 + gb_common.$get('/_geo_data/findFutureVersion?t='+Math.random(), {lineCode: lineCode}, function (rs) {
  79 + if(rs.data.length > 0)
  80 + futureInfo = rs.data[0];
  81 +
  82 + if(!futureInfo)
  83 + return;
  84 +
  85 + futureInfo.start_date_str = moment(futureInfo['start_date']).format('YYYY-MM-DD HH:mm');
  86 +
  87 + var htmlStr = '<span class="t_t_str">?</span> 后启用('+futureInfo.name+')';
  88 + $('.clock_enable_version').append(htmlStr);
  89 + $('.main_left_panel').addClass('s_future_version_info');
  90 + if(current.versions==futureInfo.versions)
  91 + $('.clock_enable_version').addClass('orange');
  92 + else
  93 + $('.clock_enable_version').removeClass('orange');
  94 +
  95 +
  96 + var _that = $('.clock_enable_version span.t_t_str')[0];
  97 + var st = new Date(futureInfo['start_date']);
  98 + gb_second_timer.initSetVersionEnableTimeFun(function (now) {
  99 + if(st.getTime() - now.getTime() <= 0) {
  100 + $('.clock_enable_version').html('服务器即将切换版本,请稍后刷新页面!').data('status', '-1');
  101 + gb_second_timer.removeVersionEnableTimeFun();
  102 + }
  103 + else{
  104 + var s =getUseTime(st, now);
  105 + _that.innerText = s;
  106 + }
  107 + });
39 108 });
40 109 };
41 110  
42 111 /**
  112 + * 点击版本启用倒计时
  113 + */
  114 + var v_e_edit_modal='#enable_versions_edit_modal';
  115 + $(document).on('click', '.clock_enable_version', function () {
  116 + if($(this).data('status')==-1)
  117 + return;
  118 + var htmlStr = temps['g_d_e_v_enable_edit-temp'](futureInfo);
  119 + $(document.body).append(htmlStr);
  120 + UIkit.modal(v_e_edit_modal).show();
  121 +
  122 + var conf = {minDate: gb_second_timer.now()};
  123 + $.extend(conf, gb_common.flatpickrDateTimeConfig);
  124 + flatpickr(v_e_edit_modal + ' input._flatpickr', conf);
  125 + });
  126 + $(document).on('click', v_e_edit_modal + ' button._submit', function () {
  127 + var f = $('form', v_e_edit_modal);
  128 + var data = f.serializeJSON();
  129 + data.lineCode = storage.getItem('geo_data_edit_line_code');
  130 +
  131 + gb_common.$post('/_geo_data/addEnableInfo', data, function () {
  132 + UIkit.modal(v_e_edit_modal).hide();
  133 + UIkit.notification("修改成功!", {status: 'success'});
  134 + init();
  135 + });
  136 + });
  137 +
  138 +
  139 + var findOne = function (no) {
  140 + for(var i=0,obj;obj=array[i++];){
  141 + if(obj.versions == no)
  142 + return obj;
  143 + }
  144 +
  145 + return null;
  146 + };
  147 +
  148 + /**
  149 + * 版本切换
  150 + */
  151 + $('._version_dropdown_wrap ul.all_version_list').on('click', 'li[data-version]', function () {
  152 + var version = $(this).data('version');
  153 +
  154 + storage.setItem("geo_data_edit_line_version" , version);
  155 + $loadPanel.show();
  156 + clearAll();
  157 + startup();
  158 + });
  159 +
  160 + /**
43 161 * 新增
44 162 */
45 163 $('.add_line_version_icon').on('click', function () {
46   - console.log('arrayarray', array);
47 164 var htmlStr = temps['geo_d_e_version_add-temp']({array: array});
48 165  
49 166 $(document.body).append(htmlStr);
50 167 UIkit.modal('#add_line_versions_modal').show();
51   - flatpickr('#add_line_versions_modal input._flatpickr', gb_common.flatpickrDateTimeConfig);
  168 +
  169 + var conf = {minDate: gb_second_timer.now()};
  170 + $.extend(conf, gb_common.flatpickrDateTimeConfig);
  171 + flatpickr('#add_line_versions_modal input._flatpickr', conf);
52 172  
53 173  
54 174 var modal = '#add_line_versions_modal';
... ... @@ -61,6 +181,26 @@ var gb_version_manage = function () {
61 181 //自动填充版本名称
62 182 $('[name=remark]', modal).on('change', reSetName);
63 183 $('[name=startDate]', modal).on('input', reSetName);
  184 +
  185 + //console.log('时间aaa', gb_second_timer.now().getTime());
  186 + });
  187 +
  188 + /**
  189 + * 删除
  190 + */
  191 + $('.remove_line_version_icon').on('click', function () {
  192 + var version = storage.getItem('geo_data_edit_line_version');
  193 + var obj = findOne(version);
  194 +
  195 + var txt = '<span style="color:#ff4444;">你确定要删除 【'+obj.lineName+'】【'+obj.name+'】走向版本?</span>';
  196 + UIkit.modal.confirm(txt).then(function() {
  197 + $loadPanel.show();
  198 + gb_common.$post('/_geo_data/deleteLineVersion', {lineCode: obj.lineCode, version: obj.versions}, function (rs) {
  199 + storage.removeItem("geo_data_edit_line_version");
  200 + clearAll();
  201 + startup();
  202 + });
  203 + });
64 204 });
65 205  
66 206 $(document).on('hidden', '.uk-modal', function () {
... ... @@ -68,12 +208,62 @@ var gb_version_manage = function () {
68 208 $('.flatpickr-calendar').remove();
69 209 });
70 210  
  211 + function getUseTime(nowDate, startDate) {
  212 + var hour = nowDate.getHours();
  213 + var min = nowDate.getMinutes();
  214 + var sec = "";
  215 + var showMin = "";
  216 + var showHour = "";
  217 +
  218 + if (nowDate.getSeconds() < startDate.getSeconds()) {
  219 + min = min - 1;
  220 + var sec_int = (nowDate.getSeconds() + 60) - startDate.getSeconds();
  221 + sec = sec_int >= 10 ? sec_int + "" : "0" + sec_int;
  222 + } else {
  223 + var sec_int = nowDate.getSeconds() - startDate.getSeconds();
  224 + sec = sec_int >= 10 ? sec_int + "" : "0" + sec_int;
  225 + }
  226 + if (min < startDate.getMinutes()) {
  227 + hour = hour - 1;
  228 + var min_int = (min + 60) - startDate.getMinutes();
  229 + showMin = min_int >= 10 ? min_int + "" : "0" + min_int;
  230 + } else {
  231 + var min_int = min - startDate.getMinutes();
  232 + showMin = min_int >= 10 ? min_int + "" : "0" + min_int;
  233 + }
  234 + if (hour < startDate.getHours()) {
  235 + var hour_int = (hour + 24) - startDate.getHours();
  236 + showHour = hour_int >= 10 ? hour_int + "" : "0" + hour_int;
  237 + } else {
  238 + var hour_int = hour - startDate.getHours();
  239 + showHour = hour_int >= 10 ? hour_int + "" : "0" + hour_int;
  240 + }
  241 + return showHour + "时" + showMin + "分" + sec;
  242 + }
71 243  
72 244 /**
73   - * 提交新增的线路版本
  245 + * 启用走向版本
74 246 */
75   - $(document).on('click', '#add_line_versions_modal button._submit', function () {
  247 + $(document).on('click', '.main_rt_tools_panel .t2_enable_icon', function () {
  248 + var obj = findOne($(this).data('version'));
  249 + var htmlStr = temps['geo_d_e_version_enable-temp'](obj);
  250 + $(document.body).append(htmlStr);
  251 + UIkit.modal('#enable_line_versions_modal').show();
  252 +
  253 + var conf = {minDate: gb_second_timer.now()};
  254 + $.extend(conf, gb_common.flatpickrDateTimeConfig);
  255 + flatpickr('#enable_line_versions_modal input._flatpickr', conf);
  256 + });
  257 + $(document).on('click', '#enable_line_versions_modal button._submit', function () {
  258 + var f = $('form', '#enable_line_versions_modal');
  259 + var data = f.serializeJSON();
  260 + data.lineCode = storage.getItem('geo_data_edit_line_code');
76 261  
  262 + gb_common.$post('/_geo_data/addEnableInfo', data, function () {
  263 + UIkit.modal('#enable_line_versions_modal').hide();
  264 + UIkit.notification("操作成功!", {status: 'success'});
  265 + init();
  266 + });
77 267 });
78 268  
79 269 res_load_ep.emitLater('load_version_manage');
... ...
src/main/resources/static/pages/base/geo_data_edit/main.html
... ... @@ -26,25 +26,18 @@
26 26 <div class="_line_info">
27 27 <div class="_line_name">
28 28 <span></span>
29   - <a uk-icon="icon: plus" class="add_line_version_icon" title="新增一个线路走向版本" uk-tooltip></a>
  29 +
  30 + <a uk-icon="icon: trash" class="remove_line_version_icon uk-animation-slide-right-small" title="删除线路版本" style="display: none" uk-tooltip></a>
  31 + <a uk-icon="icon: plus" class="add_line_version_icon" title="新增一个线路版本" uk-tooltip></a>
30 32 </div>
31 33 <div class="_version_dropdown_wrap">
32 34 <a class="_version_text"></a>
33 35 <div uk-dropdown>
34   - <ul class="uk-nav uk-dropdown-nav">
35   - <li class="uk-nav-header">历史</li>
36   - <li><a>原始版本</a></li>
37   - <li class="uk-nav-divider"></li>
38   - <li class="uk-nav-header">启用</li>
39   - <li class="uk-active"><a>20171206线路改道</a></li>
40   - <li class="uk-nav-header">未来</li>
41   - <li><a>20180206线路改道</a></li>
  36 + <ul class="uk-nav uk-dropdown-nav all_version_list">
42 37 </ul>
43 38 </div>
44 39 </div>
45   - <!--<span class="clock_enable_version">
46   - <a uk-icon="icon: clock;ratio: .7" class=""></a> 25:30:20 启用(20180206线路改道)
47   - </span>-->
  40 + <a class="clock_enable_version"></a>
48 41 </div>
49 42  
50 43 <div class="_route_info_wrap">
... ... @@ -52,9 +45,7 @@
52 45 <li><a>上行</a></li>
53 46 <li><a>下行</a></li>
54 47  
55   - <span class="rt_show_version_txt uk-badge uk-disabled">
56   - 20180206线路改道
57   - </span>
  48 + <!--<span class="rt_show_version_txt uk-badge uk-disabled uk-animation-slide-top-small"></span>-->
58 49 </ul>
59 50  
60 51 <ul class="uk-switcher uk-margin up_down_route_list">
... ... @@ -80,7 +71,9 @@
80 71 <div class="ct_search_result"></div>
81 72 </div>
82 73 <div class="main_rt_tools_panel">
83   - <a uk-icon="icon: info;ratio: .9" class="_icon"></a>
  74 + <!--<a style="color: red;" uk-icon="icon: unlock;ratio: .9" class="_icon" title="当前版本有变更未启用" uk-tooltip="pos:bottom"></a>-->
  75 +
  76 + <a uk-icon="icon: bookmark;ratio: .9" class="_icon" title="变更日志,日后再说" uk-tooltip="pos:bottom"></a>
84 77 <a uk-icon="icon: expand;ratio: .9" class="_icon full_screen_icon"></a>
85 78 </div>
86 79 </div>
... ... @@ -113,7 +106,7 @@
113 106 <!-- jquery.serializejson JSON序列化插件 -->
114 107 <script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
115 108 <!-- common js -->
116   -<script src="/real_control_v2/js/common.js"></script>
  109 +<script src="/pages/base/geo_data_edit/js/ct_common.js"></script>
117 110 <script src="/assets/js/TransGPS.js" ></script>
118 111 <!-- Geolib -->
119 112 <script src="/real_control_v2/geolib/geolib.js" ></script>
... ... @@ -136,37 +129,56 @@
136 129 if (!top.$('body').hasClass('page-sidebar-closed')) {top.$('.menu-toggler.sidebar-toggler').click();}
137 130 //全屏
138 131 $('.full_screen_icon').on('click', function () {
139   - window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen');
  132 + var $iframe = window.parent.$('#geo_edit_wrap_iframe'),
  133 + icon;
  134 + if($(this).attr('uk-icon').indexOf('expand') != -1){
  135 + $iframe.addClass('full_screen');
  136 + icon = 'shrink';
  137 + }
  138 + else{
  139 + $iframe.removeClass('full_screen');
  140 + icon = 'expand';
  141 + }
  142 + $(this).attr('uk-icon', 'icon: '+icon+';ratio: .9');
140 143 });
141 144  
142   - var gb_main_ep = new EventProxy();
  145 + var gb_main_ep;
143 146 //文件加载
144 147 var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route'
145 148 , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () {
146   -
147   - //UIkit.notification('加载完成!!');
148   - var eq = gb_main_ep;
149   -
150   - //站点
151   - gb_station_route.init(g_emit('init_road'));
152   - //路段
153   - eq.once('init_road', function () {
154   - gb_road_route.init(g_emit('init_map'))
155   - });
156   - //地图
157   - eq.once('init_map', function () {
158   - gb_ct_map._render(g_emit('end'));
159   - });
160   -
161   - eq.once('end', function () {
162   - //线路版本信息
163   - gb_version_manage.init(gb_station_route.getData()[0][0].versions);
164   -
165   - $loadPanel.hide();
166   - gb_ct_search.init();
167   - });
  149 + startup();
168 150 });
169 151  
  152 + var startup = function () {
  153 + gb_main_ep = new EventProxy();
  154 + var eq = gb_main_ep;
  155 +
  156 + //站点
  157 + gb_station_route.init(g_emit('init_road'));
  158 + //路段
  159 + eq.once('init_road', function () {
  160 + gb_road_route.init(g_emit('init_map'))
  161 + });
  162 + //地图
  163 + eq.once('init_map', function () {
  164 + gb_ct_map._render(g_emit('end'));
  165 + });
  166 +
  167 + eq.once('end', function () {
  168 + //线路版本信息
  169 + gb_version_manage.init(storage.getItem("geo_data_edit_line_version"));
  170 +
  171 + $loadPanel.hide();
  172 + gb_ct_search.init();
  173 + });
  174 + };
  175 +
  176 + var clearAll = function () {
  177 + $('.up_down_route_list .station_route').empty();
  178 + $('.up_down_route_list .road_route').empty();
  179 + gb_ct_map.clearAll();
  180 + };
  181 +
170 182 function g_emit(id) {
171 183 console.log('g_emit [' + id + ']');
172 184 return function () {
... ... @@ -198,6 +210,8 @@
198 210 });
199 211 </script>
200 212  
  213 +
  214 +<script src="/pages/base/geo_data_edit/js/server_timer.js" ></script>
201 215 <!--- js -->
202 216 <script src="/pages/base/geo_data_edit/js/common_data.js" ></script>
203 217 <script src="/pages/base/geo_data_edit/js/station_route.js" ></script>
... ...
src/main/resources/static/pages/base/interval/add.html
... ... @@ -80,7 +80,7 @@
80 80 <div class="form-actions">
81 81 <div class="row">
82 82 <div class="col-md-offset-5 col-md-7">
83   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  83 + <button type="submit" class="btn green" id="submintBtn"><i class="fa fa-check"></i> 提交</button>
84 84 <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
85 85 </div>
86 86 </div>
... ...
src/main/resources/static/pages/base/interval/js/interval-add-form.js
... ... @@ -108,6 +108,8 @@ $(function(){
108 108 submit();
109 109 // 提交
110 110 function submit() {
  111 + // 防止用户多次提交
  112 + $("#submintBtn").addClass("disabled");
111 113 // 添加数据
112 114 $post('/interval', params, function(result) {
113 115 // 如果返回结果不为空
... ... @@ -125,6 +127,7 @@ $(function(){
125 127 //loadPage('list.html');
126 128 window.location.href = 'list.html';
127 129 });
  130 + $("#submintBtn").removeClass("disabled");
128 131 }
129 132 }
130 133 });
... ...
src/main/resources/static/pages/base/line/add.html
... ... @@ -487,7 +487,7 @@
487 487 <div class="form-actions">
488 488 <div class="row">
489 489 <div class="col-md-offset-5 col-md-7">
490   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  490 + <button type="submit" class="btn green" id="submintBtn"><i class="fa fa-check"></i> 提交</button>
491 491 <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
492 492 </div>
493 493 </div>
... ...
src/main/resources/static/pages/base/line/js/line-add-form.js
... ... @@ -237,6 +237,9 @@ $(function(){
237 237 // 提交
238 238 function submit() {
239 239  
  240 + // 防止用户多次提交
  241 + $("#submintBtn").addClass("disabled");
  242 +
240 243 // 添加数据
241 244 $post('/line', params, function(result) {
242 245 // 如果返回结果不为空
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -347,7 +347,7 @@
347 347 <a href="/pages/base/lineinformation/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
348 348 </td>
349 349 <td>
350   - <a href="/pages/base/stationroute/list.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
  350 + <a href="javascript:window.localStorage.setItem('geo_data_edit_line_code' , '{{obj.lineCode}}');window.localStorage.removeItem('geo_data_edit_line_version');window.location.href='/pages/base/geo_data_edit/uk3_wrap.html';" class="btn default blue-stripe btn-sm" data-pjax> 查看 </a>
351 351 </td>
352 352 <td>
353 353 <a href="details.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 详细 </a>
... ...
src/main/resources/static/pages/base/lineinformation/add.html
... ... @@ -583,7 +583,7 @@
583 583 <div class="form-actions">
584 584 <div class="row">
585 585 <div class="col-md-offset-5 col-md-7">
586   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  586 + <button type="submit" class="btn green" id="submintBtn"><i class="fa fa-check"></i> 提交</button>
587 587 <a type="button" class="btn default lineinformation_back" href="lineinformation.html" data-pjax><i class="fa fa-times"></i> 取消</a>
588 588 </div>
589 589 </div>
... ...
src/main/resources/static/pages/base/lineinformation/js/lineinformation-add-form.js
... ... @@ -198,11 +198,13 @@ $(function(){
198 198 error.hide();
199 199  
200 200 var params = form.serializeJSON();
  201 + // 防止用户多次提交
  202 + $("#submintBtn").addClass("disabled");
201 203  
202 204 if (params.line) {
203 205  
204 206 // 添加数据
205   - $post('/lineInformation', params, function(result) {
  207 + $post('/lineInformation1', params, function(result) {
206 208  
207 209 // 如果返回结果不为空
208 210 if(result){
... ... @@ -226,6 +228,7 @@ $(function(){
226 228 });
227 229  
228 230 }
  231 + $("#submintBtn").removeClass("disabled");
229 232 }
230 233 });
231 234  
... ...
src/main/resources/static/pages/base/lineversions/add.html
... ... @@ -129,7 +129,7 @@
129 129 <div class="form-actions">
130 130 <div class="row">
131 131 <div class="col-md-offset-5 col-md-7">
132   - <button type="submit" class="btn green" ><i class="fa fa-check"></i> 提交</button>
  132 + <button type="submit" class="btn green" id="submintBtn"><i class="fa fa-check"></i> 提交</button>
133 133 <a type="button" class="btn default" href="list.html" data-pjax><i class="fa fa-times"></i> 取消</a>
134 134 </div>
135 135 </div>
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-add-from.js
... ... @@ -195,6 +195,8 @@
195 195 submit();
196 196 // 提交
197 197 function submit() {
  198 + // 防止用户多次提交
  199 + $("#submintBtn").addClass("disabled");
198 200 // 添加数据
199 201 $post('/lineVersions/add', params, function(result) {
200 202 // 如果返回结果不为空
... ... @@ -211,6 +213,7 @@
211 213 // 返回list.html页面
212 214 loadPage('list.html');
213 215 });
  216 + $("#submintBtn").removeClass("disabled");
214 217 }
215 218 }
216 219 });
... ...
src/main/resources/static/pages/base/roadspeed/add.html
... ... @@ -251,7 +251,7 @@
251 251 <a href="javascript:;" class="btn btn-outline green button-next"> 下一步
252 252 <i class="fa fa-angle-right"></i>
253 253 </a>
254   - <a href="javascript:;" class="btn green button-submit" style="display: none;"> 提交
  254 + <a href="javascript:;" class="btn green button-submit" style="display: none;" id="submintBtn"> 提交
255 255 <i class="fa fa-check"></i>
256 256 </a>
257 257 </div>
... ...
src/main/resources/static/pages/base/roadspeed/js/add-form-wizard.js
... ... @@ -76,6 +76,9 @@ var FormWizard = function() {
76 76 * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form.
77 77 */
78 78 submitHandler : function(f) {
  79 + // 防止用户多次提交
  80 + $("#submintBtn").addClass("disabled");
  81 + debugger
79 82 var params = form.serializeJSON();// 表单序列化.
80 83 if(params.roadVector=='') {
81 84 layer.msg('路段几何图形为空~请先在路段位置步骤中绘制出线路走向!');
... ... @@ -90,6 +93,7 @@ var FormWizard = function() {
90 93 }
91 94 loadPage('list.html');// 返回list.html页面.
92 95 });
  96 + $("#submintBtn").removeClass("disabled");
93 97 }
94 98 });
95 99  
... ...
src/main/resources/static/pages/base/roadspeed/js/add-vmap-world.js
... ... @@ -63,11 +63,11 @@ var SectionVmapWorlds = function() {
63 63 marker.setAnimation(BMAP_ANIMATION_BOUNCE);
64 64 }else {
65 65 // 弹出添加成功提示消息
66   - layer.msg('无法获取停车场【'+Address+'】地理位置!');
  66 + layer.msg('无法获取【'+Address+'】地理位置!');
67 67 }
68 68 }else {
69 69 // 弹出添加成功提示消息
70   - layer.msg('无法获取停车场【'+Address+'】地理位置!');
  70 + layer.msg('无法获取【'+Address+'】地理位置!');
71 71 }
72 72 });
73 73 // 根据检索词发起检索。
... ...
src/main/resources/static/pages/base/section/add.html
... ... @@ -376,7 +376,7 @@
376 376 <a href="javascript:;" class="btn btn-outline green button-next"> 下一步
377 377 <i class="fa fa-angle-right"></i>
378 378 </a>
379   - <a href="javascript:;" class="btn green button-submit" style="display: none;"> 提交
  379 + <a href="javascript:;" class="btn green button-submit" style="display: none;" id="submintBtn"> 提交
380 380 <i class="fa fa-check"></i>
381 381 </a>
382 382 </div>
... ...
src/main/resources/static/pages/base/section/js/add-form-wizard.js
... ... @@ -81,6 +81,8 @@ var FormWizard = function() {
81 81 * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form.
82 82 */
83 83 submitHandler : function(f) {
  84 + // 防止用户多次提交
  85 + $("#submintBtn").addClass("disabled");
84 86 var params = form.serializeJSON();// 表单序列化.
85 87 if(params.bsectionVector=='') {
86 88 layer.msg('路段几何图形为空~请先在路段位置步骤中绘制出线路走向!');
... ... @@ -95,6 +97,7 @@ var FormWizard = function() {
95 97 }
96 98 loadPage('list.html');// 返回list.html页面.
97 99 });
  100 + $("#submintBtn").removeClass("disabled");
98 101 }
99 102 });
100 103  
... ... @@ -151,8 +154,8 @@ var FormWizard = function() {
151 154 var stationStartValue = $('#stationStartInput').val();
152 155 var stationEndValue = $('#stationEndInput').val();
153 156 var paramsStationsArray = [];
154   - paramsStationsArray[0] = stationStartValue+'公交车站';
155   - paramsStationsArray[1]= stationEndValue+'公交车站';
  157 + paramsStationsArray[0] = stationStartValue;
  158 + paramsStationsArray[1]= stationEndValue;
156 159 $('#sectionNameInput').val(stationStartValue + '至' + stationEndValue );
157 160 if(baseResValue == 0) {
158 161 $('.leftUtils').hide();
... ... @@ -166,8 +169,8 @@ var FormWizard = function() {
166 169 });
167 170 });
168 171 }else if(baseResValue ==1) {
169   - SectionVmapWorlds.localSearchFromAdreesToPoint(stationStartValue+'公交车站');
170   - SectionVmapWorlds.localSearchFromAdreesToPoint(stationEndValue+'公交车站');
  172 + SectionVmapWorlds.localSearchFromAdreesToPoint(stationStartValue);
  173 + SectionVmapWorlds.localSearchFromAdreesToPoint(stationEndValue);
171 174 // SectionVmapWorlds.drawingManagerOpen();
172 175 }
173 176 $('html,body').animate({scrollTop: ($('#form-wizard-info').offset().top-5) + "px"},500);
... ...
src/main/resources/static/pages/base/section/js/add-vmap-world.js
... ... @@ -63,11 +63,11 @@ var SectionVmapWorlds = function() {
63 63 marker.setAnimation(BMAP_ANIMATION_BOUNCE);
64 64 }else {
65 65 // 弹出添加成功提示消息
66   - layer.msg('无法获取停车场【'+Address+'】地理位置!');
  66 + layer.msg('无法获取【'+Address+'】地理位置!');
67 67 }
68 68 }else {
69 69 // 弹出添加成功提示消息
70   - layer.msg('无法获取停车场【'+Address+'】地理位置!');
  70 + layer.msg('无法获取【'+Address+'】地理位置!');
71 71 }
72 72 });
73 73 // 根据检索词发起检索。
... ... @@ -174,7 +174,7 @@ var SectionVmapWorlds = function() {
174 174 var f = arguments.callee;
175 175 var poiOne = new BMap.Point(stationsPoint[index].potion.lng,stationsPoint[index].potion.lat);
176 176 var poiTwo = new BMap.Point(stationsPoint[index+1].potion.lng,stationsPoint[index+1].potion.lat);
177   - var transit = new BMap.DrivingRoute(mapB, {renderOptions: {map: mapB},onPolylinesSet: searchPolylinesSet});
  177 + var transit = new BMap.DrivingRoute(mapB, {renderOptions: {map: mapB,enableDragging : true},onPolylinesSet: searchPolylinesSet});
178 178 function searchPolylinesSet(results){
179 179 if (transit.getStatus() != BMAP_STATUS_SUCCESS){
180 180 }else {
... ...
src/main/resources/static/pages/base/station/add.html
... ... @@ -425,7 +425,7 @@
425 425 <a href="javascript:;" class="btn btn-outline green button-next"> 下一步
426 426 <i class="fa fa-angle-right"></i>
427 427 </a>
428   - <a href="javascript:;" class="btn green button-submit" style="display: none;"> 提交
  428 + <a href="javascript:;" class="btn green button-submit" style="display: none;" id="submintBtn"> 提交
429 429 <i class="fa fa-check"></i>
430 430 </a>
431 431 </div>
... ...
src/main/resources/static/pages/base/station/js/add-form-wizard.js
... ... @@ -90,6 +90,8 @@ var FormWizard = function() {
90 90 * 默认:default (native) form submit;当表单通过验证,提交表单。回调函数有个默认参数form
91 91 */
92 92 submitHandler : function(f) {
  93 + // 防止用户多次提交
  94 + $("#submintBtn").addClass("disabled");
93 95 // 表单序列化
94 96 var params = form.serializeJSON();
95 97 if(params.shapesType=='圆形')
... ... @@ -108,6 +110,7 @@ var FormWizard = function() {
108 110 // 返回list.html页面
109 111 loadPage('list.html');
110 112 });
  113 + $("#submintBtn").removeClass("disabled");
111 114 }
112 115 });
113 116 // 当站点类型为中途站或者终点站时,上一站点为必填项!
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_delay.html
... ... @@ -81,7 +81,7 @@
81 81 </div>
82 82 </div>
83 83  
84   -<script type="text/javascript" src="js/jquery.table2excel.min.js"></script>
  84 +<script type="text/javascript" src="/pages/forms/statement/js/jquery.table2excel.min.js"></script>
85 85 <script>
86 86 $(function(){
87 87 $('#export').attr('disabled', "true");
... ... @@ -220,7 +220,13 @@
220 220 $("#sumMap tr").addClass("hidden");
221 221 $get('/pcpc/firstAndLastBus_sum', params, function(result){
222 222 // 把数据填充到模版中
223   - var tbodyHtml = template('list_firstAndLastBus_delay',{list:result[result.length - 1].map});
  223 + var list;
  224 + if(result.length - 1 > 0){
  225 + list = result[result.length - 1].map;
  226 + } else {
  227 + list = result;
  228 + }
  229 + var tbodyHtml = template('list_firstAndLastBus_delay',{list:list});
224 230 // 把渲染好的模版html文本追加到表格中
225 231 $('#forms tbody').html(tbodyHtml);
226 232  
... ... @@ -262,4 +268,9 @@
262 268 <td>{{obj.remarks1}}</td>
263 269 </tr>
264 270 {{/each}}
  271 + {{if list.length == 0}}
  272 + <tr>
  273 + <td colspan="20"><h6 class="muted">没有相关数据</h6></td>
  274 + </tr>
  275 + {{/if}}
265 276 </script>
266 277 \ No newline at end of file
... ...
src/main/resources/static/pages/forms/statement/firstAndLastBus_sum.html
... ... @@ -135,7 +135,7 @@
135 135 </div>
136 136 </div>
137 137  
138   -<script type="text/javascript" src="js/jquery.table2excel.min.js"></script>
  138 +<script type="text/javascript" src="/pages/forms/statement/js/jquery.table2excel.min.js"></script>
139 139 <script>
140 140 $(function(){
141 141 $('#export').attr('disabled', "true");
... ... @@ -302,6 +302,8 @@
302 302 $("#forms .hidden").removeClass("hidden");
303 303 $("#map tr").addClass("hidden");
304 304 $("#sumMap tr").addClass("hidden");
  305 + $("#exportMap").addClass("hidden");
  306 + $("#exportSumMap").addClass("hidden");
305 307 $get('/pcpc/firstAndLastBus_sum', params, function(result){
306 308 // 把数据填充到模版中
307 309 var tbodyHtml = template('list_firstAndLastBus_sum',{list:result});
... ... @@ -432,6 +434,11 @@
432 434 {{/if}}
433 435 </tr>
434 436 {{/each}}
  437 + {{if list.length == 0}}
  438 + <tr>
  439 + <td colspan="20"><h6 class="muted">没有相关数据</h6></td>
  440 + </tr>
  441 + {{/if}}
435 442 </script>
436 443 <script type="text/html" id="list_sumMaps">
437 444 {{each list as obj i}}
... ... @@ -447,4 +454,9 @@
447 454 <td>{{obj.remarks1}}</td>
448 455 </tr>
449 456 {{/each}}
  457 + {{if list.length == 0}}
  458 + <tr>
  459 + <td colspan="20"><h6 class="muted">没有相关数据</h6></td>
  460 + </tr>
  461 + {{/if}}
450 462 </script>
451 463 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/mapmonitor/fragments/playback_v3/layout.html
... ... @@ -96,7 +96,11 @@
96 96 <dl>
97 97 <dd>
98 98 {{if item.abnormalType == 'speed'}}
99   - 超速({{item.speed}})
  99 + {{if item.speed>=100}}
  100 + 速度异常
  101 + {{else}}
  102 + 超速({{item.speed}})
  103 + {{/if}}
100 104 {{else if item.abnormalType == 'outbound'}}
101 105 越界
102 106 {{/if}}
... ...