Commit 7631c99fb297e10c63dc50bf4ee33aae77efc59b

Authored by 潘钊
2 parents 2f5b50c5 9ca70c2c

Merge branch 'pudong' into jiading

Showing 172 changed files with 9799 additions and 1655 deletions
src/main/java/com/bsth/XDApplication.java
... ... @@ -139,17 +139,17 @@ public class XDApplication implements CommandLineRunner {
139 139  
140 140 /** 线调业务 */
141 141 sexec.scheduleWithFixedDelay(scheduleRefreshThread, 10, 120, TimeUnit.SECONDS);//班次更新线程
142   - sexec.scheduleWithFixedDelay(scheduleLateThread, 70, 30, TimeUnit.SECONDS);//检查班次误点
  142 + sexec.scheduleWithFixedDelay(scheduleLateThread, 140, 30, TimeUnit.SECONDS);//检查班次误点
143 143 sexec.scheduleWithFixedDelay(gpsDataLoader, 100, 2, TimeUnit.SECONDS);//抓取GPS数据
144 144  
145 145 sexec.scheduleWithFixedDelay(offlineMonitorThread, 120, 60, TimeUnit.SECONDS);//GPS设备掉离线
146   - sexec.scheduleWithFixedDelay(schedulePstThread, 120, 10, TimeUnit.SECONDS);//班次延迟入库线程
147   - sexec.scheduleWithFixedDelay(seiPstThread, 160, 60, TimeUnit.SECONDS);//班次修正日志入库
  146 + sexec.scheduleWithFixedDelay(schedulePstThread, 180, 10, TimeUnit.SECONDS);//班次延迟入库线程
  147 + sexec.scheduleWithFixedDelay(seiPstThread, 180, 60, TimeUnit.SECONDS);//班次修正日志入库
148 148 sexec.scheduleWithFixedDelay(directivesPstThread, 180, 120, TimeUnit.SECONDS);//调度指令延迟入库
149   - //sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
  149 + sexec.scheduleWithFixedDelay(threadMonotor, 240, 60, TimeUnit.SECONDS);//线程监听(防止重要的线程阻塞、异常结束。以及部分主备切换工作)
150 150 sexec.scheduleWithFixedDelay(sampleTimeDataLoader, 140, 120 * 60, TimeUnit.SECONDS);//到离站预测需要的站点间耗时数据
151 151 sexec.scheduleWithFixedDelay(basicDataLoader, 2, 2, TimeUnit.HOURS);//基础数据更新
152   - sexec.scheduleWithFixedDelay(autoExecScanThread, 160, 50, TimeUnit.SECONDS);//班次自动执行
  152 + sexec.scheduleWithFixedDelay(autoExecScanThread, 180, 50, TimeUnit.SECONDS);//班次自动执行
153 153 DirectivePushQueue.start();//消息队列 -指令,系统下发的
154 154 WebSocketPushQueue.start();//消息队列 -webSocket ,推送至线调web页面的
155 155  
... ...
src/main/java/com/bsth/controller/DownloadController.java
... ... @@ -19,9 +19,6 @@ import org.springframework.http.MediaType;
19 19 import org.springframework.http.ResponseEntity;
20 20 import org.springframework.stereotype.Component;
21 21 import org.springframework.web.bind.annotation.RequestMapping;
22   -
23   -import com.google.protobuf.UnknownFieldSet.Field;
24   -import com.mysql.fabric.Response;
25 22  
26 23 /**
27 24 * <一句话功能简述>
... ... @@ -55,11 +52,12 @@ public class DownloadController
55 52 headers, HttpStatus.CREATED);
56 53 }
57 54  
58   - @RequestMapping("download")
  55 + @RequestMapping("download")
59 56 public void download(HttpServletResponse response,String fileName)
60 57 throws IOException {
61 58 // String fileNames=URLDecoder.decode(fileName,"UTF-8");
62   - fileName =fileName + ".xls";
  59 + if(!fileName.contains(".xls"))
  60 + fileName =fileName + ".xls";
63 61 String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName;
64 62 File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的
65 63 // String filename = file.getName();// 获取日志文件名称
... ... @@ -82,6 +80,7 @@ public class DownloadController
82 80 public void downloadList(HttpServletResponse response,String fileName)
83 81 throws IOException {
84 82 // String fileNames=URLDecoder.decode(fileName,"UTF-8");
  83 + File files = new File(this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName);//
85 84 fileName = fileName + ".zip";
86 85 String moudelPath = this.getClass().getResource("/").getPath()+ "static/pages/forms/export/"+fileName;
87 86 File file = new File(moudelPath);// path是根据日志路径和文件名拼接出来的
... ... @@ -99,7 +98,8 @@ public class DownloadController
99 98 os.flush();
100 99 os.close();
101 100 file.delete();
102   - }
  101 + deleteFiles(files);
  102 + }
103 103  
104 104  
105 105 @RequestMapping("downloadModel")
... ... @@ -125,4 +125,23 @@ public class DownloadController
125 125 }
126 126  
127 127  
  128 + /**
  129 + * 删除文件夹
  130 + * @param files
  131 + * @return
  132 + */
  133 + public Boolean deleteFiles(File files){
  134 + if (files.isDirectory()) {
  135 + String[] children = files.list();
  136 + //递归删除目录中的子目录下
  137 + for (int i=0; i<children.length; i++) {
  138 + boolean success = deleteFiles(new File(files, children[i]));
  139 + if (!success) {
  140 + return false;
  141 + }
  142 + }
  143 + }
  144 + //目录此时为空,可以删除
  145 + return files.delete();
  146 + }
128 147 }
... ...
src/main/java/com/bsth/controller/LineController.java
... ... @@ -90,7 +90,7 @@ public class LineController extends BaseController&lt;Line, Integer&gt; {
90 90 lineVersions.setName("原始版本");
91 91 lineVersions.setLine(t);
92 92 lineVersions.setLineCode(t.getLineCode());
93   - lineVersions.setStartDate(t.getCreateDate());
  93 + lineVersions.setStartDate(new java.sql.Date(new Date().getTime()));
94 94 lineVersions.setEndDate(new java.sql.Date(endDate.getTime()));// 2088-8-8 00:00:00
95 95 lineVersions.setVersions(1);
96 96 lineVersions.setStatus(1);
... ...
src/main/java/com/bsth/controller/LineVersionsController.java
1 1 package com.bsth.controller;
2 2  
3   -import java.text.ParseException;
4   -import java.text.SimpleDateFormat;
5   -import java.util.Date;
6 3 import java.util.List;
7 4 import java.util.Map;
8 5  
... ... @@ -12,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestMethod;
12 9 import org.springframework.web.bind.annotation.RequestParam;
13 10 import org.springframework.web.bind.annotation.RestController;
14 11  
15   -import com.bsth.entity.Line;
16 12 import com.bsth.entity.LineVersions;
17 13 import com.bsth.repository.LineRepository;
18 14 import com.bsth.service.LineVersionsService;
... ... @@ -80,4 +76,21 @@ public class LineVersionsController extends BaseController&lt;LineVersions, Integer
80 76 return service.add(map);
81 77 }
82 78  
  79 + /**
  80 + * 根据线路id获取当前版本号
  81 + *
  82 + */
  83 + @RequestMapping(value = "findCurrentVersion", method = RequestMethod.GET)
  84 + public Integer findCurrentVersion(@RequestParam(defaultValue = "lineId") int lineId) {
  85 + return service.findCurrentVersion(lineId);
  86 + }
  87 +
  88 + /**
  89 + * 根据id发布版本号(修改isupdate字段)
  90 + */
  91 + @RequestMapping(value = "issueVersion", method = RequestMethod.POST)
  92 + public Map<String, Object> issueVersion(@RequestParam(defaultValue = "id") int id) {
  93 + return service.issueVersion(id);
  94 + }
  95 +
83 96 }
... ...
src/main/java/com/bsth/controller/SectionRouteController.java
... ... @@ -10,6 +10,7 @@ import org.springframework.web.bind.annotation.RequestParam;
10 10 import org.springframework.web.bind.annotation.RestController;
11 11  
12 12 import com.bsth.entity.SectionRoute;
  13 +import com.bsth.entity.StationRouteCache;
13 14 import com.bsth.service.SectionRouteService;
14 15  
15 16 /**
... ... @@ -55,6 +56,12 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
55 56 public Iterable<SectionRoute> list(@RequestParam Map<String, Object> map) {
56 57 return routeService.list(map);
57 58 }
  59 +
  60 + @RequestMapping(value = "/cacheList", method = RequestMethod.GET)
  61 + public List<StationRouteCache> cacheList(@RequestParam Map<String, Object> map) {
  62 +// routeService.cacheList(map)
  63 + return null;
  64 + }
58 65  
59 66 /**
60 67 * @Description :TODO(查询路段信息)
... ... @@ -76,8 +83,8 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
76 83 *
77 84 * @return Map<String, Object>
78 85 */
79   - @RequestMapping(value = "/findSectionCache" , method = RequestMethod.GET)
80   - public List<Map<String, Object>> findPointsCache(@RequestParam Map<String, Object> map) {
  86 + @RequestMapping(value = "/findCacheSection" , method = RequestMethod.GET)
  87 + public List<Map<String, Object>> getSectionRouteCache(@RequestParam Map<String, Object> map) {
81 88 return routeService.getSectionRouteCache(map);
82 89 }
83 90  
... ... @@ -105,6 +112,11 @@ public class SectionRouteController extends BaseController&lt;SectionRoute, Integer
105 112 return routeService.findUpSectionRouteCode(map);
106 113 }
107 114  
  115 + @RequestMapping(value = "/findCacheUpSectionRouteCode" , method = RequestMethod.GET)
  116 + public List<Map<String, Object>> findCacheUpSectionRouteCode(@RequestParam Map<String, Object> map) {
  117 + return routeService.findCacheUpSectionRouteCode(map);
  118 + }
  119 +
108 120 /**
109 121 * @Description :TODO(引用路段)
110 122 *
... ...
src/main/java/com/bsth/controller/StationController.java
... ... @@ -157,4 +157,15 @@ public class StationController extends BaseController&lt;Station, Integer&gt; {
157 157 return GetUIDAndCode.getStationId();
158 158  
159 159 }
  160 + /**
  161 + * @Description :TODO(查询站点编码)
  162 + *
  163 + * @return int <stationCode站点编码>
  164 + */
  165 + @RequestMapping(value="stationCacheSave" , method = RequestMethod.POST)
  166 + public Map<String, Object> stationCacheSave(@RequestParam Map<String, Object> map) {
  167 + map.put("createBy", "");
  168 + map.put("updateBy", "");
  169 + return service.stationCacheSave(map);
  170 + }
160 171 }
... ...
src/main/java/com/bsth/controller/forms/ExportController.java
... ... @@ -214,7 +214,47 @@ public class ExportController {
214 214  
215 215 return resList;
216 216 }
  217 + @RequestMapping(value = "/singledataExportTj", method = RequestMethod.GET)
  218 + public List<Map<String, Object>> singledataExportTj(@RequestParam Map<String, Object> map) {
  219 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"), sdfSimple = new SimpleDateFormat("yyyyMMdd");
  220 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  221 + ReportUtils ee = new ReportUtils();
  222 + List<Singledata> singledata = formsService.singledatatj(map);
  223 + List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
  224 + int i = 1;
  225 + for (Singledata l : singledata) {
  226 + Map<String, Object> m = new HashMap<String, Object>();
  227 + m.put("i", i);
  228 + m.put("rQ", l.getrQ());
  229 + m.put("gS", l.getgS());
  230 + m.put("xL", l.getXlmc());
  231 + m.put("clzbh", l.getClzbh());
  232 + m.put("jsy", l.getJsy());
  233 + m.put("jName", l.getjName());
  234 + m.put("sgh", l.getSgh());
  235 + m.put("sName", l.getsName());
  236 + m.put("jhlc", l.getJhlc());
  237 + m.put("emptMileage", l.getEmptMileage());
  238 + m.put("hyl", l.getHyl());
  239 + m.put("jzl", l.getJzl());
  240 + m.put("unyyyl", l.getUnyyyl());
  241 + m.put("jhjl", l.getJhjl());
  242 + resList.add(m);
  243 +
  244 + i++;
  245 + }
  246 +
  247 + try {
  248 + listI.add(resList.iterator());
  249 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  250 + ee.excelReplace(listI, new Object[] { map }, path + "mould/singledata.xls",
  251 + path + "export/路单数据" + sdfSimple.format(sdfMonth.parse(map.get("startDate").toString())) + ".xls");
  252 + } catch (Exception e) {
  253 + e.printStackTrace();
  254 + }
217 255  
  256 + return resList;
  257 + }
218 258 // 车辆加注
219 259 @RequestMapping(value = "/vehicleloadingExport", method = RequestMethod.GET)
220 260 public List<Map<String, Object>> vehicleloadingExport(@RequestParam Map<String, Object> map) {
... ...
src/main/java/com/bsth/controller/forms/MCY_FormsController.java
... ... @@ -83,9 +83,15 @@ public class MCY_FormsController {
83 83 @RequestMapping(value = "/singledatanew", method = RequestMethod.GET)
84 84 public List<Singledata> singledatanew(@RequestParam Map<String, Object> map) {
85 85  
86   - return formsService.singledata(map);
  86 + return formsService.singledatanew(map);
87 87 }
88 88  
  89 + @RequestMapping(value = "/singledatatj", method = RequestMethod.GET)
  90 + public List<Singledata> singledatatj(@RequestParam Map<String, Object> map) {
  91 +
  92 + return formsService.singledatatj(map);
  93 + }
  94 +
89 95 // 车辆加注
90 96 @RequestMapping(value = "/vehicleloading", method = RequestMethod.GET)
91 97 public List<Vehicleloading> vehicleloading(@RequestParam String line, @RequestParam String data) {
... ...
src/main/java/com/bsth/controller/geo_data/GeoDataController.java 0 → 100644
  1 +package com.bsth.controller.geo_data;
  2 +
  3 +import com.bsth.entity.geo_data.GeoStation;
  4 +import com.bsth.service.geo_data.GeoDataService;
  5 +import org.springframework.beans.factory.annotation.Autowired;
  6 +import org.springframework.web.bind.annotation.RequestMapping;
  7 +import org.springframework.web.bind.annotation.RequestMethod;
  8 +import org.springframework.web.bind.annotation.RequestParam;
  9 +import org.springframework.web.bind.annotation.RestController;
  10 +
  11 +import java.util.Map;
  12 +
  13 +/**
  14 + * Created by panzhao on 2017/12/7.
  15 + */
  16 +@RestController
  17 +@RequestMapping("/_geo_data")
  18 +public class GeoDataController {
  19 +
  20 + @Autowired
  21 + GeoDataService geoDataService;
  22 +
  23 + @RequestMapping("findGeoStations")
  24 + public Map<String, Object> findGeoStations(@RequestParam String lineCode){
  25 + return geoDataService.findGeoStations(lineCode);
  26 + }
  27 +
  28 +
  29 + @RequestMapping("findGeoRoad")
  30 + public Map<String, Object> findGeoRoad(@RequestParam String lineCode){
  31 + return geoDataService.findGeoRoad(lineCode);
  32 + }
  33 +
  34 + @RequestMapping(value = "updateBufferInfo",method = RequestMethod.POST)
  35 + public Map<String, Object> updateBufferInfo(GeoStation station){
  36 + return geoDataService.updateBufferInfo(station);
  37 + }
  38 +
  39 + @RequestMapping(value = "updateStationName",method = RequestMethod.POST)
  40 + public Map<String, Object> updateStationName(@RequestParam Map<String, Object> map){
  41 + return geoDataService.updateStationName(map);
  42 + }
  43 +}
0 44 \ No newline at end of file
... ...
src/main/java/com/bsth/controller/oil/DlbController.java
... ... @@ -224,4 +224,9 @@ public class DlbController extends BaseController&lt;Dlb, Integer&gt;{
224 224 // Ylb t=new Ylb();
225 225 return service.saveDlb(t);
226 226 }
  227 +
  228 + @RequestMapping(value = "/updateJsy",method = RequestMethod.GET)
  229 + public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){
  230 + return service.update(map);
  231 + }
227 232 }
... ...
src/main/java/com/bsth/controller/oil/YlbController.java
... ... @@ -11,6 +11,8 @@ import java.util.Iterator;
11 11 import java.util.List;
12 12 import java.util.Map;
13 13  
  14 +import javax.servlet.http.HttpServletRequest;
  15 +
14 16 import org.springframework.beans.factory.annotation.Autowired;
15 17 import org.springframework.data.domain.Page;
16 18 import org.springframework.data.domain.PageRequest;
... ... @@ -35,14 +37,19 @@ import com.google.common.base.Splitter;
35 37 @RequestMapping("ylb")
36 38 public class YlbController extends BaseController<Ylb, Integer>{
37 39 @Autowired
38   - YlbService yblService;
  40 + YlbService ylbService;
39 41  
40 42 @RequestMapping(value = "/saveYlb",method = RequestMethod.POST)
41 43 public Map<String, Object> saveYlb(Ylb t){
42 44 // SysUser user = SecurityUtils.getCurrentUser();
43 45 t.setCreatetime(new Date());
44 46 // Ylb t=new Ylb();
45   - return yblService.saveYlb(t);
  47 + return ylbService.saveYlb(t);
  48 + }
  49 +
  50 + @RequestMapping(value = "/updateJsy",method = RequestMethod.GET)
  51 + public Map<String, Object> updateJsy(@RequestParam Map<String, Object> map){
  52 + return ylbService.update(map);
46 53 }
47 54  
48 55  
... ... @@ -55,7 +62,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
55 62 public Map<String, Object> obtain(@RequestParam Map<String, Object> map) throws Exception{
56 63 Map<String, Object> list =new HashMap<String, Object>();
57 64 try {
58   - list = yblService.obtain(map);
  65 +
  66 + list = ylbService.obtain(map);
59 67 } catch (Exception e) {
60 68 // TODO Auto-generated catch block
61 69 throw e;
... ... @@ -69,7 +77,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
69 77 public Map<String, Object> saveYlbList(@RequestParam Map<String, Object> map){
70 78 Map<String, Object> list=new HashMap<String, Object>();
71 79 try {
72   - list = yblService.saveYlbList(map);
  80 + list = ylbService.saveYlbList(map);
73 81 } catch (Exception e) {
74 82 // TODO Auto-generated catch block
75 83 e.printStackTrace();
... ... @@ -85,7 +93,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
85 93 public Map<String, Object> sort(@RequestParam Map<String, Object> map){
86 94 Map<String, Object> list=new HashMap<String, Object>();
87 95 try {
88   - list=yblService.sort(map);
  96 + list=ylbService.sort(map);
89 97 } catch (Exception e) {
90 98 // TODO: handle exception
91 99 }
... ... @@ -101,7 +109,8 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
101 109 public Map<String, Object> outAndIn(@RequestParam Map<String, Object> map) throws Exception{
102 110 Map<String, Object> list=new HashMap<String, Object>();
103 111 try {
104   - list=yblService.outAndIn(map);
  112 +
  113 + list=ylbService.outAndIn(map);
105 114 } catch (Exception e) {
106 115 // TODO: handle exception
107 116 }
... ... @@ -118,7 +127,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
118 127 public Map<String, Object> checkYl(@RequestParam Map<String, Object> map){
119 128 Map<String, Object> list=new HashMap<String, Object>();
120 129 try {
121   - list=yblService.checkYl(map);
  130 + list=ylbService.checkYl(map);
122 131 } catch (Exception e) {
123 132 // TODO: handle exception
124 133 }
... ... @@ -146,7 +155,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
146 155 String rq=map.get("rq").toString();
147 156 int lx=Integer.parseInt(map.get("sxtj").toString().trim());
148 157 if(lx>0){
149   - map.put("nbbm_in", yblService.checkNbmmNum(rq, map.get("ssgsdm_like").toString(),
  158 + map.put("nbbm_in", ylbService.checkNbmmNum(rq, map.get("ssgsdm_like").toString(),
150 159 map.get("fgsdm_like").toString(), map.get("xlbm_like").toString(),
151 160 map.get("nbbm_eq").toString(),lx));
152 161 }
... ... @@ -194,7 +203,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
194 203 */
195 204 @RequestMapping(value = "/ylbList",method = RequestMethod.GET)
196 205 public List<Ylb> ylbList(@RequestParam Map<String, Object> map){
197   - List<Ylb> ylbList=yblService.listYlb(map);
  206 + List<Ylb> ylbList=ylbService.listYlb(map);
198 207 return ylbList;
199 208 }
200 209  
... ... @@ -202,7 +211,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
202 211 public Map<String, Object> deleteIds(@RequestParam Map<String, Object> map) {
203 212 Map<String, Object> maps=new HashMap<String, Object>();
204 213 try {
205   - maps= yblService.deleteIds(map);
  214 + maps= ylbService.deleteIds(map);
206 215 } catch (Exception e) {
207 216 // TODO Auto-generated catch block
208 217 e.printStackTrace();
... ... @@ -210,19 +219,19 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
210 219 return maps;
211 220 }
212 221 @RequestMapping(value="/oilListMonth")
213   - public List<Ylb> oilListMonth(@RequestParam Map<String, Object> map){
214   - return yblService.oilListMonth(map);
  222 + public List<Map<String, Object>> oilListMonth(@RequestParam Map<String, Object> map){
  223 + return ylbService.oilListMonth(map);
215 224 }
216 225  
217 226 @RequestMapping(value = "/checkJsy",method = RequestMethod.GET)
218 227 public String checkJsy(@RequestParam Map<String, Object> map){
219   - String list=yblService.checkJsy(map);
  228 + String list=ylbService.checkJsy(map);
220 229 return list;
221 230 }
222 231  
223 232 @RequestMapping(value = "/sumYlb",method = RequestMethod.GET)
224 233 public Map<String, Object> sumYlb(@RequestParam Map<String, Object> map){
225   - Map<String, Object> list=yblService.sumYlb(map);
  234 + Map<String, Object> list=ylbService.sumYlb(map);
226 235 return list;
227 236 }
228 237  
... ... @@ -232,7 +241,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
232 241 sdfSimple = new SimpleDateFormat("yyyyMMdd");
233 242 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
234 243 ReportUtils ee = new ReportUtils();
235   - List<Ylb> ylb= yblService.listYlb(map);
  244 + List<Ylb> ylb= ylbService.listYlb(map);
236 245 // (new CustomerSpecs<Ylb>(map)).iterator();
237 246 List<Map<String, Object>> resList = new ArrayList<Map<String, Object>>();
238 247 for (Ylb y : ylb) {
... ... @@ -299,7 +308,7 @@ public class YlbController extends BaseController&lt;Ylb, Integer&gt;{
299 308 public Map<String, Object> updateHistory(@RequestParam Map<String, Object> map) throws Exception{
300 309 Map<String, Object> list =new HashMap<String, Object>();
301 310 try {
302   - list = yblService.updateHistory(map);
  311 + list = ylbService.updateHistory(map);
303 312 } catch (Exception e) {
304 313 // TODO Auto-generated catch block
305 314 throw e;
... ...
src/main/java/com/bsth/controller/realcontrol/ScheduleRealInfoController.java
... ... @@ -23,9 +23,6 @@ import java.util.*;
23 23 @RequestMapping("/realSchedule")
24 24 public class ScheduleRealInfoController extends BaseController<ScheduleRealInfo, Long> {
25 25  
26   - /*@Autowired
27   - GetSchedulePlanThread getSchedulePlanThread;*/
28   -
29 26 @Autowired
30 27 ScheduleRealInfoService scheduleRealInfoService;
31 28  
... ...
src/main/java/com/bsth/controller/realcontrol/anomalyCheckController.java
... ... @@ -110,4 +110,14 @@ public class anomalyCheckController {
110 110 dayOfSchedule.removeExecPlan(nbbm);
111 111 return 1;
112 112 }
  113 +
  114 + @RequestMapping(value = "/sch_re_calc_id_maps")
  115 + public int reCalcIdMaps(){
  116 + return dayOfSchedule.reCalcIdMaps();
  117 + }
  118 +
  119 + @RequestMapping(value = "/sch_size_string")
  120 + public String schSizeString(){
  121 + return dayOfSchedule.sizeString();
  122 + }
113 123 }
... ...
src/main/java/com/bsth/controller/report/ReportController.java
... ... @@ -278,6 +278,12 @@ public class ReportController {
278 278 return service.countByList(map);
279 279 }
280 280  
  281 + @RequestMapping(value="/countLineMileage2")
  282 + public List<Map<String,Object>> countLineMileage2(@RequestParam Map<String, Object> map){
  283 +
  284 + return service.countByList2(map);
  285 + }
  286 +
281 287 @RequestMapping(value="/countBusMileage")
282 288 public List<Map<String,Object>> countBusMileage(@RequestParam Map<String, Object> map){
283 289 return service.countByBusList(map);
... ... @@ -325,4 +331,10 @@ public class ReportController {
325 331  
326 332 return lMap;
327 333 }
  334 +
  335 +
  336 + @RequestMapping(value="/online")
  337 + public Map<String, Object> online(@RequestParam Map<String, Object> map){
  338 + return service.online(map);
  339 + }
328 340 }
... ...
src/main/java/com/bsth/data/ThreadMonotor.java
1 1 package com.bsth.data;
2 2  
3   -import org.slf4j.Logger;
4   -import org.slf4j.LoggerFactory;
  3 +import com.bsth.data.gpsdata_v2.DataHandleProcess;
  4 +import com.bsth.data.gpsdata_v2.thread.GpsDataLoaderThread;
5 5 import org.springframework.stereotype.Component;
6 6  
7 7 /**
... ... @@ -10,32 +10,10 @@ import org.springframework.stereotype.Component;
10 10 @Component
11 11 public class ThreadMonotor extends Thread{
12 12  
13   - Logger log = LoggerFactory.getLogger(this.getClass());
14   -
15 13 @Override
16 14 public void run() {
17   -
18   - //线调GPS分析主线程
19   - /*if(GpsRealAnalyse.isBlock()){
20   - log.warn("GpsRealAnalyse isBlock true !!!!");
21   - GpsRealAnalyse.shutdown();
22   - }*/
23   -
24   - /*if(GpsRealAnalyse.isIdle()){
25   - //切换到备用的网关实时GPS对照数据
  15 + //切换到备用的网关实时GPS对照数据
  16 + if(DataHandleProcess.isBlock())
26 17 GpsDataLoaderThread.setFlag(-1);
27   - }*/
28   -
29   - //webSocket 消息推送队列
30   - /*if(WebSocketPushQueue.isIdle()){
31   - log.warn("WebSocketPushQueue isIdle true !!!!");
32   - WebSocketPushQueue.start();
33   - }*/
34   -
35   - //网关指令推送队列(系统自动发送的)
36   - /*if(DirectivePushQueue.isIdle()){
37   - log.warn("DirectivePushQueue isIdle true !!!!");
38   - DirectivePushQueue.start();
39   - }*/
40 18 }
41 19 }
42 20 \ No newline at end of file
... ...
src/main/java/com/bsth/data/car_out_info/CarOutInfoHandler.java
... ... @@ -50,6 +50,9 @@ public class CarOutInfoHandler {
50 50  
51 51 Logger logger = LoggerFactory.getLogger(this.getClass());
52 52  
  53 +
  54 + ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
  55 + List<ScheduleRealInfo> pstList = new ArrayList<>();
53 56 /**
54 57 * 全量更新发车信息表
55 58 */
... ... @@ -57,24 +60,27 @@ public class CarOutInfoHandler {
57 60 try{
58 61 //将班次按线路分组
59 62 List<ScheduleRealInfo> all = new ArrayList<>(dayOfSchedule.findAll());
60   - ArrayListMultimap<String, ScheduleRealInfo> xlMaps = ArrayListMultimap.create();
61 63 for(ScheduleRealInfo sch : all){
62 64 xlMaps.put(sch.getXlBm(), sch);
63 65 }
64 66  
65 67 Set<String> ks = xlMaps.keySet();
66 68 for (String k : ks) {
67   - update(xlMaps.get(k));
  69 + pstList.addAll(update(xlMaps.get(k)));
68 70 }
  71 +
  72 + save(pstList);
  73 + pstList.clear();
  74 + xlMaps.clear();
  75 + //logger.info("更新发车信息表!!");
69 76 }catch (Exception e){
70 77 logger.error("", e);
71 78 }
72 79 }
73 80  
74   - public void update(List<ScheduleRealInfo> list) {
  81 + public List<ScheduleRealInfo> update(List<ScheduleRealInfo> list) {
75 82 if (list.size() == 0)
76   - return;
77   - String lineCode = list.get(0).getXlBm();
  83 + return new ArrayList<>();
78 84 //按上下行分组
79 85 List<ScheduleRealInfo> ups = new ArrayList<>(), downs = new ArrayList<>();
80 86 for (ScheduleRealInfo sch : list) {
... ... @@ -87,7 +93,12 @@ public class CarOutInfoHandler {
87 93 ScheduleRealInfo[] upArray = nexts(ups),
88 94 downArray = nexts(downs);
89 95  
90   - final List<ScheduleRealInfo> pstArray = mergeArray(upArray, downArray);
  96 + List<ScheduleRealInfo> pstArray = mergeArray(upArray, downArray);
  97 +
  98 + return pstArray;
  99 + }
  100 +
  101 + private void save(final List<ScheduleRealInfo> pstList){
91 102 //编程式事务
92 103 DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
93 104 DefaultTransactionDefinition def = new DefaultTransactionDefinition();
... ... @@ -96,13 +107,13 @@ public class CarOutInfoHandler {
96 107  
97 108 try{
98 109 //删除
99   - jdbcTemplate.update("delete from bsth_t_clfcxxb where line_code=?", lineCode);
  110 + jdbcTemplate.update("delete from bsth_t_clfcxxb");
100 111 //重新写入
101 112 jdbcTemplate.batchUpdate("insert into bsth_t_clfcxxb(rq, line_code, line_name, lp_name, lp_sn, dfsj, nbbm, cph, bc_type, end_station_name, updown, jGh, jName, remarks, sn)" +
102 113 " VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", new BatchPreparedStatementSetter() {
103 114 @Override
104 115 public void setValues(PreparedStatement ps, int i) throws SQLException {
105   - ScheduleRealInfo sch = pstArray.get(i);
  116 + ScheduleRealInfo sch = pstList.get(i);
106 117 ps.setString(1, sch.getScheduleDateStr());
107 118 ps.setString(2, sch.getXlBm());
108 119 ps.setString(3, sch.getXlName());
... ... @@ -122,7 +133,7 @@ public class CarOutInfoHandler {
122 133  
123 134 @Override
124 135 public int getBatchSize() {
125   - return pstArray.size();
  136 + return pstList.size();
126 137 }
127 138 });
128 139  
... ... @@ -159,8 +170,8 @@ public class CarOutInfoHandler {
159 170 ScheduleRealInfo[] array = new ScheduleRealInfo[3];
160 171 Collections.sort(list, schDFSJComparator);
161 172  
162   - int count = 0, threshold = 1000 * 60 * 60 * 4;
163   - long t = System.currentTimeMillis();
  173 + int count = 0;//, threshold = 1000 * 60 * 60 * 4;
  174 + //long t = System.currentTimeMillis();
164 175 for (ScheduleRealInfo sch : list) {
165 176 if (count == 3)
166 177 break;
... ... @@ -180,8 +191,8 @@ public class CarOutInfoHandler {
180 191 || StringUtils.isNotEmpty(sch.getZdsjActual()))
181 192 continue;
182 193  
183   - if (t - sch.getDfsjT() > threshold)
184   - continue;
  194 + /*if (t - sch.getDfsjT() > threshold)
  195 + continue;*/
185 196  
186 197 array[count] = sch;
187 198 count++;
... ...
src/main/java/com/bsth/data/directive/DayOfDirectives.java
... ... @@ -15,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
15 15 import org.springframework.stereotype.Component;
16 16  
17 17 import java.util.*;
  18 +import java.util.concurrent.ConcurrentHashMap;
18 19  
19 20 /**
20 21 *
... ... @@ -52,8 +53,8 @@ public class DayOfDirectives {
52 53  
53 54  
54 55 static{
55   - d60Map = new HashMap<>();
56   - d64Map = new HashMap<>();
  56 + d60Map = new ConcurrentHashMap<>();
  57 + d64Map = new ConcurrentHashMap<>();
57 58 pstDirectives = new LinkedList<>();
58 59 }
59 60  
... ...
src/main/java/com/bsth/data/directive/DirectivesPstThread.java
... ... @@ -51,10 +51,6 @@ public class DirectivesPstThread extends Thread {
51 51 logger.warn("save 指令,发现 deleted=true 的班次,id=" + sch.getId());
52 52 continue;
53 53 }
54   - if(dayOfSchedule.get(sch.getId()) == null){
55   - logger.warn("班次:" + sch.getId() + "不存在了,调度指令放弃入库。");
56   - continue;
57   - }
58 54 }
59 55 d60Repository.save(d60);
60 56 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/DataHandleProcess.java
... ... @@ -4,18 +4,14 @@ import com.bsth.data.gpsdata_v2.cache.GpsCacheData;
4 4 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
5 5 import com.bsth.data.gpsdata_v2.handlers.*;
6 6 import com.google.common.collect.ArrayListMultimap;
  7 +import org.apache.commons.lang3.StringUtils;
7 8 import org.slf4j.Logger;
8 9 import org.slf4j.LoggerFactory;
9 10 import org.springframework.beans.factory.annotation.Autowired;
10 11 import org.springframework.stereotype.Component;
11 12  
12   -import java.util.ArrayList;
13   -import java.util.List;
14   -import java.util.Set;
15   -import java.util.concurrent.CountDownLatch;
16   -import java.util.concurrent.ExecutorService;
17   -import java.util.concurrent.Executors;
18   -import java.util.concurrent.ThreadFactory;
  13 +import java.util.*;
  14 +import java.util.concurrent.*;
19 15  
20 16 /**
21 17 * 实时信号数据处理
... ... @@ -24,12 +20,6 @@ import java.util.concurrent.ThreadFactory;
24 20 @Component
25 21 public class DataHandleProcess {
26 22  
27   - static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);
28   - final static int POOL_SIZE = 25;
29   -
30   - static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1, new HandlerThreadFactory());
31   - public static CountDownLatch count;
32   -
33 23 @Autowired
34 24 GpsStateProcess gpsStateProcess;
35 25 @Autowired
... ... @@ -42,12 +32,28 @@ public class DataHandleProcess {
42 32 OutStationProcess outStationProcess;
43 33 @Autowired
44 34 ReverseRouteProcess reverseRouteProcess;
45   -
46 35 @Autowired
47 36 GpsRealData gpsRealData;
48 37  
  38 +
  39 + static Logger logger = LoggerFactory.getLogger(DataHandleProcess.class);
  40 +
  41 + final static int POOL_SIZE = 25;
  42 +
  43 + static ExecutorService threadPool = Executors.newFixedThreadPool(POOL_SIZE + 1);
  44 + public static CountDownLatch count;
  45 +
  46 + static long lastTime;
  47 +
  48 + public static boolean isBlock() {
  49 + return System.currentTimeMillis() - lastTime > 1000 * 30;
  50 + }
  51 +
49 52 public void handle(List<GpsEntity> list) {
50 53 try {
  54 + if (list.size() == 0)
  55 + return;
  56 + lastTime = System.currentTimeMillis();
51 57 //按设备号分组数据(一个设备的多条数据,必须在一个线程里跑)
52 58 ArrayListMultimap multimap = ArrayListMultimap.create();
53 59 for (GpsEntity gps : list) {
... ... @@ -67,21 +73,50 @@ public class DataHandleProcess {
67 73 logger.info("analyse gps size: " + list.size() + ", ks: " + ks.size());
68 74 count = new CountDownLatch(ks.size());
69 75  
  76 + List<Future> fRs = new ArrayList<>(ks.size());
70 77 for (Integer index : ks) {
71   - threadPool.execute(new SignalHandleThread(dataListMap.get(index), count));
  78 + fRs.add(threadPool.submit(new SignalHandleThread(dataListMap.get(index), count)));
  79 + }
  80 +
  81 + //按线路分组gps
  82 + /*ArrayListMultimap multimap = ArrayListMultimap.create();
  83 + for (GpsEntity gps : list) {
  84 + multimap.put(gps.getLineId(), gps);
72 85 }
73 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 +
74 96 //等待子线程结束
75 97 count.await();
76 98  
  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 +
77 108 //加入实时gps对照
78 109 for (GpsEntity gps : list)
79 110 gpsRealData.put(gps);
  111 +
  112 + logger.info("time , " + (System.currentTimeMillis() - lastTime));
80 113 } catch (Exception e) {
81 114 logger.error("", e);
82 115 }
83 116 }
84 117  
  118 + static GpsComp comp = new GpsComp();
  119 +
85 120 public class SignalHandleThread implements Runnable {
86 121  
87 122 List<GpsEntity> list;
... ... @@ -94,45 +129,44 @@ public class DataHandleProcess {
94 129  
95 130 @Override
96 131 public void run() {
97   - try {
98   - for (GpsEntity gps : list) {
99   - try{
100   - if(Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)
101   - continue;
102   -
103   - gpsStateProcess.process(gps);//状态处理
104   - stationInsideProcess.process(gps);//场站内外判定
105   - reverseRouteProcess.process(gps);//反向路由处理
106   - abnormalStateProcess.process(gps);//超速越界
107   -
108   - inStationProcess.process(gps);//进站
109   - outStationProcess.process(gps);//出站
110   -
111   - GpsCacheData.putGps(gps);//历史gps缓存
112   - }catch (Exception e){
113   - logger.error("", e);
114   - }
  132 + //try {
  133 + Collections.sort(list, comp);
  134 + for (GpsEntity gps : list) {
  135 + try {
  136 + if(StringUtils.isEmpty(gps.getNbbm()))
  137 + continue;
  138 + if (Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) > 1000 * 60 * 20)
  139 + continue;
  140 +
  141 + gpsStateProcess.process(gps);//状态处理
  142 + stationInsideProcess.process(gps);//场站内外判定
  143 + reverseRouteProcess.process(gps);//反向路由处理
  144 + abnormalStateProcess.process(gps);//超速越界
  145 +
  146 + inStationProcess.process(gps);//进站
  147 + outStationProcess.process(gps);//出站
  148 +
  149 + GpsCacheData.putGps(gps);//历史gps缓存
  150 + } catch (Exception e) {
  151 + logger.error("", e);
115 152 }
116   - } finally {
  153 + }
  154 +
  155 + logger.info(Thread.currentThread().getName() + " -countDown : " + count.getCount());
  156 + count.countDown();
  157 + /*} finally {
117 158 if (count != null)
118 159 count.countDown();
119   - }
  160 + logger.info(Thread.currentThread().getName() + " -countDown : " + count.getCount());
  161 + }*/
120 162 }
121 163 }
122 164  
123   - static class MyUncaughtExceptionHandler implements Thread.UncaughtExceptionHandler {
124   - @Override
125   - public void uncaughtException(Thread t, Throwable e) {
126   - logger.error("caught " , e);
127   - }
128   - }
  165 + public static class GpsComp implements Comparator<GpsEntity> {
129 166  
130   - static class HandlerThreadFactory implements ThreadFactory {
131 167 @Override
132   - public Thread newThread(Runnable r) {
133   - Thread t = new Thread(r);
134   - t.setUncaughtExceptionHandler(new MyUncaughtExceptionHandler());
135   - return t;
  168 + public int compare(GpsEntity g1, GpsEntity g2) {
  169 + return g1.getTimestamp().compareTo(g2.getTimestamp());
136 170 }
137 171 }
138 172 }
139 173 \ No newline at end of file
... ...
src/main/java/com/bsth/data/gpsdata_v2/GpsRealData.java
... ... @@ -97,7 +97,7 @@ public class GpsRealData {
97 97 /**
98 98 * @Title: get @Description: TODO(设备号获取GPS)
99 99 */
100   - public GpsEntity get(String deviceId) {
  100 + public static GpsEntity get(String deviceId) {
101 101 return gpsMap.get(deviceId);
102 102 }
103 103  
... ...
src/main/java/com/bsth/data/gpsdata_v2/cache/GpsCacheData.java
... ... @@ -38,7 +38,7 @@ public class GpsCacheData {
38 38 * @param nbbm
39 39 */
40 40 public static void remove(String nbbm){
41   - logger.info("清除车辆到离站轨迹, " + nbbm);
  41 + //logger.info("清除车辆到离站轨迹, " + nbbm);
42 42 trailListMultimap.removeAll(nbbm);
43 43 }
44 44  
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/AbnormalStateProcess.java
... ... @@ -25,34 +25,34 @@ public class AbnormalStateProcess {
25 25 */
26 26 private static final double OUT_BOUNDS_THRESHOLD = 100;
27 27  
28   -
29 28 public void process(GpsEntity gps) {
30   - if(isOffline(gps))
  29 + if (isOffline(gps))
31 30 return;
32 31  
33   - if(overspeed(gps))
  32 + if (overspeed(gps))
34 33 return;
35 34  
36   - if(outOfBounds((gps)))
  35 + if (outOfBounds((gps)))
37 36 return;
38 37 }
39 38  
40   - private boolean isOffline(GpsEntity gps){
  39 + private boolean isOffline(GpsEntity gps) {
41 40 return gps.getAbnormalStatus() != null && gps.getAbnormalStatus().equals("offline");
42 41 }
43 42  
44 43  
45 44 /**
46 45 * 是否超速
  46 + *
47 47 * @param gps
48 48 * @return
49 49 */
50   - private boolean overspeed(GpsEntity gps){
  50 + private boolean overspeed(GpsEntity gps) {
51 51 double maxSpeed = DEFAULT_SPEED_LIMIT;
52   - if(GeoCacheData.speedLimit(gps.getLineId()) != null)
  52 + if (GeoCacheData.speedLimit(gps.getLineId()) != null)
53 53 maxSpeed = GeoCacheData.speedLimit(gps.getLineId());
54 54  
55   - if(gps.getSpeed() > maxSpeed){
  55 + if (gps.getSpeed() > maxSpeed) {
56 56 gps.setAbnormalStatus("overspeed");
57 57 return true;
58 58 }
... ... @@ -62,12 +62,13 @@ public class AbnormalStateProcess {
62 62  
63 63 /**
64 64 * 是否越界
  65 + *
65 66 * @param gps
66 67 * @return
67 68 */
68   - public boolean outOfBounds(GpsEntity gps){
  69 + public boolean outOfBounds(GpsEntity gps) {
69 70 //只处理场站外的车
70   - if(gps.getInstation() != 0){
  71 + if (gps.getInstation() != 0) {
71 72 return false;
72 73 }
73 74  
... ... @@ -76,15 +77,15 @@ public class AbnormalStateProcess {
76 77  
77 78 double min = -1, distance;
78 79  
79   - for(CtLineString lineString : list){
80   - distance = GeoUtils.getDistanceFromLine(lineString.getS(),lineString.getE(), point);
  80 + for (CtLineString lineString : list) {
  81 + distance = GeoUtils.getDistanceFromLine(lineString.getS(), lineString.getE(), point);
81 82  
82   - if(min == -1 || min > distance)
  83 + if (min == -1 || min > distance)
83 84 min = distance;
84 85 }
85 86  
86 87 gps.setOutOfBoundDistance(min);
87   - if(min > OUT_BOUNDS_THRESHOLD){
  88 + if (min > OUT_BOUNDS_THRESHOLD) {
88 89 gps.setAbnormalStatus("outBounds");
89 90 return true;
90 91 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/GpsStateProcess.java
... ... @@ -20,26 +20,26 @@ public class GpsStateProcess {
20 20 @Autowired
21 21 GpsStatusManager gpsStatusManager;
22 22  
23   - public void process(GpsEntity gps){
  23 + public void process(GpsEntity gps) {
24 24 //在执行的任务
25 25 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
26 26  
27   - if(null == sch)
  27 + if (null == sch)
28 28 return;
29 29  
30 30 byte upDown = Byte.parseByte(sch.getXlDir());
31 31  
32   - if(gps.getUpDown() != upDown){
  32 + if (gps.getUpDown() != upDown) {
33 33 gps.setUpDown(upDown);//修正走向
34 34 }
35 35  
36   - if((!gps.isService() || gps.getUpDown() != upDown) &&
37   - !dayOfSchedule.emptyService(sch)){
  36 + if ((!gps.isService() || gps.getUpDown() != upDown) &&
  37 + !dayOfSchedule.emptyService(sch)) {
38 38 //下发指令纠正车载的 营运状态 和 走向
39 39 gpsStatusManager.changeServiceState(gps.getNbbm(), upDown, 0, "同步@系统");
40 40 }
41 41  
42   - if(!sch.getXlBm().equals(gps.getLineId())){
  42 + if (!sch.getXlBm().equals(gps.getLineId())) {
43 43 //切换车载的 线路编码
44 44 gpsStatusManager.changeLine(gps.getNbbm(), sch.getXlBm(), "同步@系统");
45 45 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/InStationProcess.java
... ... @@ -45,32 +45,32 @@ public class InStationProcess {
45 45 public void process(GpsEntity gps) {
46 46 //自动执行的班次信号,滚蛋
47 47 LineConfig config = lineConfigData.get(gps.getLineId());
48   - if(null != config && config.isAutoExec())
  48 + if (null != config && config.isAutoExec())
49 49 return;
50 50  
51 51 GpsEntity prev = GpsCacheData.getPrev(gps);
52 52  
53   - if(null == prev)
  53 + if (null == prev)
54 54 return;
55 55  
56 56 //从站外到站内
57   - if(prev.getInstation() == 0 && gps.getInstation() > 0){
  57 + if (prev.getInstation() == 0 && gps.getInstation() > 0) {
58 58 inStation(gps, prev);
59 59 }
60 60  
61 61 //从站内到另一个站内
62   - if(prev.getInstation() == 1 && gps.getInstation() == 1
  62 + if (prev.getInstation() == 1 && gps.getInstation() == 1
63 63 && !prev.getStopNo().equals(gps.getStopNo())
64 64 && !prev.getStation().getName().equals(gps.getStation().getName()))
65 65 inStation(gps, prev);
66 66  
67 67 //从场内到站内
68   - if(prev.getInstation() == 2 && gps.getInstation() == 1){
  68 + if (prev.getInstation() == 2 && gps.getInstation() == 1) {
69 69 inStation(gps, prev);
70 70 }
71 71  
72 72 //被起点站覆盖的情况下进场
73   - if(isInPark(gps, prev))
  73 + if (isInPark(gps, prev))
74 74 inStation(gps, prev);
75 75 }
76 76  
... ... @@ -96,7 +96,7 @@ public class InStationProcess {
96 96  
97 97 //进终点
98 98 if (flow && null != sch &&
99   - ((sch.getZdzCode().equals(gps.getStopNo()) && gps.getInstation()>0) || sch.getZdzCode().equals(gps.getCarparkNo()))) {
  99 + ((sch.getZdzCode().equals(gps.getStopNo()) && gps.getInstation() > 0) || sch.getZdzCode().equals(gps.getCarparkNo()))) {
100 100 inEndStation(sch, gps);
101 101 isEnd = true;
102 102 }
... ... @@ -267,8 +267,8 @@ public class InStationProcess {
267 267 }
268 268 }
269 269  
270   - private boolean isInPark(GpsEntity gps, GpsEntity prve){
271   - if(StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo()))
  270 + private boolean isInPark(GpsEntity gps, GpsEntity prve) {
  271 + if (StringUtils.isNotEmpty(gps.getCarparkNo()) && StringUtils.isEmpty(prve.getCarparkNo()))
272 272 return true;
273 273 return false;
274 274 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/OutStationProcess.java
... ... @@ -42,7 +42,7 @@ public class OutStationProcess {
42 42 private final static int MAX_BEFORE_TIME = 1000 * 60 * 120;
43 43  
44 44 public void process(GpsEntity gps) {
45   - //自动执行的班次信号,滚蛋
  45 + //自动执行的线路,滚蛋
46 46 LineConfig config = lineConfigData.get(gps.getLineId());
47 47 if (null != config && config.isAutoExec())
48 48 return;
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/ReverseRouteProcess.java
... ... @@ -8,6 +8,8 @@ import com.bsth.data.gpsdata_v2.entity.StationRoute;
8 8 import com.bsth.data.schedule.DayOfSchedule;
9 9 import com.bsth.entity.realcontrol.LineConfig;
10 10 import com.bsth.entity.realcontrol.ScheduleRealInfo;
  11 +import org.slf4j.Logger;
  12 +import org.slf4j.LoggerFactory;
11 13 import org.springframework.beans.factory.annotation.Autowired;
12 14 import org.springframework.stereotype.Component;
13 15  
... ... @@ -30,54 +32,58 @@ public class ReverseRouteProcess {
30 32 @Autowired
31 33 LineConfigData lineConfigData;
32 34  
33   - public void process(GpsEntity gps){
  35 + Logger logger = LoggerFactory.getLogger(this.getClass());
34 36  
  37 + public void process(GpsEntity gps) {
35 38 LineConfig config = lineConfigData.get(gps.getLineId());
36   - if(null != config && config.isReadReverse() &&
37   - reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())){
  39 + if (null != config && config.isReadReverse() &&
  40 + reversRoute(gps) && !GeoCacheData.isLoopLine(gps.getLineId())) {
38 41  
39 42 ScheduleRealInfo sch = dayOfSchedule.executeCurr(gps.getNbbm());
40   - if(isInOut(sch) || !sch.getXlBm().equals(gps.getLineId()))
  43 +
  44 + if (null == sch)
  45 + return;
  46 + if (isInOut(sch) || !sch.getXlBm().equals(gps.getLineId()))
41 47 return;
42 48  
43 49 //next
44 50 ScheduleRealInfo next = dayOfSchedule.next(sch);
45   - if(isInOut(next))
  51 + if (isInOut(next))
46 52 return;
47 53  
48 54 //跳下一个班次
49   - if(Math.abs(next.getDfsjT() - gps.getTimestamp()) < TIME_THRESHOLD)
  55 + if (Math.abs(next.getDfsjT() - gps.getTimestamp()) < TIME_THRESHOLD)
50 56 dayOfSchedule.addExecPlan(next);
51 57 }
52 58 }
53 59  
54 60 private boolean reversRoute(GpsEntity gps) {
55   - if(gps.getInstation() != 1)
  61 + if (gps.getInstation() != 1)
56 62 return false;
57 63  
58 64 int sortNo = gps.getStation().getRouteSort();
59   - StationRoute prev = GpsCacheData.prevStation(gps);
  65 + StationRoute prev = GpsCacheData.prevStation(gps);
60 66 //和上一个站点是反向
61   - if(null != prev && sortNo < prev.getRouteSort()){
  67 + if (null != prev && sortNo < prev.getRouteSort()) {
62 68  
63 69 //满足3个进站反向信号
64 70 List<StationRoute> prevs = GpsCacheData.prevMultiStation(gps);
65 71  
66 72 int count = 0;
67   - for(StationRoute s : prevs){
68   - if(sortNo < s.getRouteSort())
69   - count ++;
  73 + for (StationRoute s : prevs) {
  74 + if (sortNo < s.getRouteSort())
  75 + count++;
70 76 sortNo = s.getRouteSort();
71 77 }
72 78  
73   - if(count >= REVER_THRESHOLD)
  79 + if (count >= REVER_THRESHOLD)
74 80 return true;
75 81 }
76 82  
77 83 return false;
78 84 }
79 85  
80   - private boolean isInOut(ScheduleRealInfo sch){
  86 + private boolean isInOut(ScheduleRealInfo sch) {
81 87 return sch.getBcType().equals("in") || sch.getBcType().equals("out");
82 88 }
83 89 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/handlers/StationInsideProcess.java
... ... @@ -16,7 +16,7 @@ import java.util.List;
16 16 @Component
17 17 public class StationInsideProcess {
18 18  
19   - public void process(GpsEntity gps){
  19 + public void process(GpsEntity gps) {
20 20 //是否在场内
21 21 String parkCode = GeoUtils.gpsInCarpark(gps);
22 22  
... ... @@ -42,13 +42,13 @@ public class StationInsideProcess {
42 42 //上一个点位
43 43 GpsEntity prev = GpsCacheData.getPrev(gps);
44 44  
45   - if(null != prev){
  45 + if (null != prev) {
46 46 //继承前置围栏状态
47   - if(null == premiseCode && null != prev.getPremiseCode())
  47 + if (null == premiseCode && null != prev.getPremiseCode())
48 48 gps.setPremiseCode(prev.getPremiseCode());
49 49  
50 50 //在场,站外
51   - if(gps.getInstation() == 0){
  51 + if (gps.getInstation() == 0) {
52 52 gps.setStopNo(prev.getStopNo());//继承上一个点的站点编码
53 53 }
54 54 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/load/SocketClientLoader.java
... ... @@ -67,10 +67,10 @@ public class SocketClientLoader {
67 67  
68 68 list = JSON.parseArray(sb.toString(), GpsEntity.class);
69 69  
  70 + logger.info("load end ! size: " + list.size());
70 71 //过滤掉无效的点位
71 72 list = GpsDataUtils.clearInvalid(list);
72 73  
73   - logger.info("load end!");
74 74 for (GpsEntity gps : list) {
75 75 gps.setNbbm(BasicData.deviceId2NbbmMap.get(gps.getDeviceId()));
76 76 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataRecovery.java
... ... @@ -84,7 +84,7 @@ public class GpsDataRecovery implements ApplicationContextAware {
84 84 Calendar calendar = Calendar.getInstance();
85 85 int dayOfYear = calendar.get(Calendar.DAY_OF_YEAR);
86 86  
87   - String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=329"; //+ dayOfYear;
  87 + String sql = "select DEVICE_ID,LAT,LON,TS,SPEED_GPS,LINE_ID,SERVICE_STATE,SERVER_TS from bsth_c_gps_info where days_year=346"; //+ dayOfYear;
88 88 JdbcTemplate jdbcTemplate = new JdbcTemplate(DBUtils_MS.getDataSource());
89 89  
90 90 List<GpsEntity> list =
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/GpsDataUtils.java
1 1 package com.bsth.data.gpsdata_v2.utils;
2 2  
  3 +import com.bsth.data.gpsdata_v2.GpsRealData;
3 4 import com.bsth.data.gpsdata_v2.entity.GpsEntity;
4 5 import org.slf4j.Logger;
5 6 import org.slf4j.LoggerFactory;
... ... @@ -24,7 +25,22 @@ public class GpsDataUtils {
24 25 List<GpsEntity> rs = new ArrayList<>();
25 26  
26 27 try {
  28 + GpsEntity prev;
27 29 for (GpsEntity gps : list) {
  30 + prev = GpsRealData.get(gps.getDeviceId());
  31 +
  32 + //不接收过期数据
  33 + if(prev != null){
  34 +
  35 + if(gps.getTimestamp().longValue() < prev.getTimestamp().longValue())
  36 + continue;
  37 +
  38 + if(prev.getTimestamp().equals(gps.getTimestamp())&&
  39 + prev.getLat().equals(gps.getLat()) &&
  40 + prev.getLon().equals(gps.getLon()))
  41 + continue;
  42 + }
  43 +
28 44 if (gps.getValid() == 0 && Math.abs(gps.getTimestamp() - gps.getServerTimestamp()) < 1000 * 60 * 20)
29 45 rs.add(gps);
30 46 }
... ...
src/main/java/com/bsth/data/gpsdata_v2/utils/SignalSchPlanMatcher.java
... ... @@ -45,7 +45,8 @@ public class SignalSchPlanMatcher {
45 45  
46 46 if(null != near && !near.getId().equals(sch.getId())){
47 47  
48   - if(Math.abs(t - near.getDfsjT()) < Math.abs((t - sch.getDfsjT()))){
  48 + int nearDiff = (int) Math.abs(t - near.getDfsjT());
  49 + if(nearDiff < 1000 * 60 * 8 && nearDiff < Math.abs((t - sch.getDfsjT()))){
49 50  
50 51 dayOfSchedule.addExecPlan(near);
51 52 return false;
... ... @@ -57,47 +58,6 @@ public class SignalSchPlanMatcher {
57 58 log.error("", e);
58 59 }
59 60 return true;
60   - /*try{
61   - //会不会是分班没有完成
62   - if(sch.getBcType().equals("in") && t - sch.getDfsjT() > 1000 * 60 * 20){
63   - ScheduleRealInfo fbFirst = dayOfSchedule.nextByBcType(sch, "normal");
64   -
65   - if(fbFirst == null || !fbFirst.getQdzCode().equals(gps.getStopNo()))
66   - return;
67   -
68   - long dt = fbFirst.getDfsjT();
69   - //晚于待发前4分钟 -执行分班的首个营运
70   - if(dt - t < 1000 * 60 * 4){
71   - dayOfSchedule.addExecPlan(fbFirst);
72   - return;
73   - }
74   - }
75   -
76   - //线路编码不匹配
77   - if("out".equals(sch.getBcType()) && !sch.getXlBm().equals(gps.getLineId())){
78   - ScheduleRealInfo nextOut = dayOfSchedule.nextByBcType(sch, "out");
79   - if(nextOut != null && nextOut.getXlBm().equals(gps.getLineId())
80   - && fcSpace(sch, gps) > fcSpace(nextOut, gps)){
81   - dayOfSchedule.addExecPlan(nextOut);
82   - return;
83   - }
84   - }
85   - }catch (Exception e){
86   - log.error("", e);
87   - }
88   -
89   - //下一个相同走向的班次
90   - ScheduleRealInfo next = dayOfSchedule.nextSame(sch);
91   - if(next == null || !next.getQdzCode().equals(sch.getQdzCode()))
92   - return;
93   -
94   - //晚于班次间隔百分之70,跳下一个班次
95   - double s = (int) (next.getDfsjT() - sch.getDfsjT());
96   - double r = (int) (t - sch.getDfsjT());
97   - if(r / s > 0.7){
98   - if(dayOfSchedule.addExecPlan(next))
99   - outMatch(gps, next);
100   - }*/
101 61 }
102 62  
103 63 /**
... ...
src/main/java/com/bsth/data/schedule/DayOfSchedule.java
... ... @@ -13,11 +13,8 @@ import com.bsth.entity.realcontrol.ScheduleRealInfo;
13 13 import com.bsth.entity.schedule.SchedulePlanInfo;
14 14 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
15 15 import com.bsth.service.schedule.SchedulePlanInfoService;
16   -import com.bsth.util.BatchSaveUtils;
17 16 import com.bsth.websocket.handler.SendUtils;
18   -import com.google.common.base.Predicate;
19 17 import com.google.common.collect.ArrayListMultimap;
20   -import com.google.common.collect.Collections2;
21 18 import org.apache.commons.lang3.StringUtils;
22 19 import org.joda.time.format.DateTimeFormat;
23 20 import org.joda.time.format.DateTimeFormatter;
... ... @@ -25,12 +22,20 @@ import org.slf4j.Logger;
25 22 import org.slf4j.LoggerFactory;
26 23 import org.springframework.beans.factory.annotation.Autowired;
27 24 import org.springframework.dao.DataIntegrityViolationException;
  25 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
28 26 import org.springframework.jdbc.core.JdbcTemplate;
  27 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
29 28 import org.springframework.stereotype.Component;
  29 +import org.springframework.transaction.TransactionDefinition;
  30 +import org.springframework.transaction.TransactionStatus;
  31 +import org.springframework.transaction.support.DefaultTransactionDefinition;
30 32  
  33 +import java.sql.PreparedStatement;
  34 +import java.sql.SQLException;
31 35 import java.text.ParseException;
32 36 import java.text.SimpleDateFormat;
33 37 import java.util.*;
  38 +import java.util.concurrent.ConcurrentHashMap;
34 39 import java.util.concurrent.ConcurrentLinkedQueue;
35 40  
36 41 /**
... ... @@ -65,6 +70,10 @@ public class DayOfSchedule {
65 70 // 排序器
66 71 private static ScheduleComparator.FCSJ schFCSJComparator;
67 72  
  73 + private static ScheduleComparator.DFSJ schDFSJComparator;
  74 +
  75 + private static Long sch_max_id=-1L;
  76 +
68 77 @Autowired
69 78 LineConfigData lineConfigData;
70 79  
... ... @@ -92,11 +101,12 @@ public class DayOfSchedule {
92 101 nbbmScheduleMap = ArrayListMultimap.create();
93 102 lpScheduleMap = ArrayListMultimap.create();
94 103  
95   - id2SchedulMap = new HashMap<>();
  104 + id2SchedulMap = new ConcurrentHashMap<>();
96 105 pstBuffer = new ConcurrentLinkedQueue<>();
97 106 schFCSJComparator = new ScheduleComparator.FCSJ();
  107 + schDFSJComparator = new ScheduleComparator.DFSJ();
98 108 currSchDateMap = new HashMap<>();
99   - carExecutePlanMap = new HashMap<>();
  109 + carExecutePlanMap = new ConcurrentHashMap<>();
100 110  
101 111 schedulePlanMap = new HashMap<>();
102 112 }
... ... @@ -258,7 +268,7 @@ public class DayOfSchedule {
258 268 public void clearRAMData(String lineCode) {
259 269 int count = 0;
260 270 List<ScheduleRealInfo> remList = new ArrayList<>();
261   - Collection<ScheduleRealInfo> all = id2SchedulMap.values();
  271 + Collection<ScheduleRealInfo> all = nbbmScheduleMap.values();
262 272 for (ScheduleRealInfo sch : all) {
263 273 if (sch.getXlBm().equals(lineCode))
264 274 remList.add(sch);
... ... @@ -324,11 +334,13 @@ public class DayOfSchedule {
324 334 // 转换为实际排班
325 335 realList = JSONArray.parseArray(JSON.toJSONString(planItr), ScheduleRealInfo.class);
326 336  
  337 + Date d = new Date();
327 338 SimpleDateFormat sdf = new SimpleDateFormat("HH:mm");
328 339 String fcsj;
329 340 for (ScheduleRealInfo sch : realList) {
330 341 sch.setScheduleDateStr(fmtyyyyMMdd.print(sch.getScheduleDate().getTime()));
331 342 sch.setRealExecDate(sch.getScheduleDateStr());
  343 + sch.setCreateDate(d);
332 344  
333 345 if (StringUtils.isEmpty(sch.getFcsj()))
334 346 sch.setFcsj("00:00");
... ... @@ -377,26 +389,108 @@ public class DayOfSchedule {
377 389 return realList;
378 390 }
379 391  
  392 +
  393 + public synchronized long getId(){
  394 + if(sch_max_id==-1){
  395 + sch_max_id = schRepository.getMaxId();
  396 + if(null == sch_max_id)
  397 + sch_max_id = 3000L;//留一点空间补数据用
  398 + sch_max_id += 5;
  399 + }
  400 + else
  401 + sch_max_id ++;
  402 + return sch_max_id;
  403 + }
  404 +
380 405 /**
381 406 * @Title: batchSave
382 407 * @Description: TODO(批量入库)
383 408 */
384 409 private void batchSave(List<ScheduleRealInfo> list) {
385   - // 查询数据库最大ID
386   - Long id = schRepository.getMaxId();
387   - if (null == id)
388   - id = 0L;
389   - id++;
390   -
391 410 SimpleDateFormat sdfyyyyMMdd = new SimpleDateFormat("yyyy-MM-dd");
392 411 for (ScheduleRealInfo item : list) {
393 412 item.setSpId(item.getId());// 保留原始的计划ID
394   - item.setId(id++);// 设置ID
  413 + item.setId(getId());// 设置ID
395 414 item.setScheduleDateStr(sdfyyyyMMdd.format(item.getScheduleDate()));
396 415 }
397 416  
  417 + //编程式事务
  418 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  419 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  420 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  421 + TransactionStatus status = tran.getTransaction(def);
  422 +
  423 + try{
  424 + final List<ScheduleRealInfo> pstList = list;
  425 + //写入
  426 + jdbcTemplate.batchUpdate("insert into bsth_c_s_sp_info_real(id,bc_type,bcs,bcsj,cl_zbh,create_date,dfsj,directive_state,fcno,fcsj,fcsj_actual,j_gh,j_name,jhlc,lp_name,qdz_code,qdz_name,real_exec_date,remarks,s_gh,s_name,schedule_date,schedule_date_str,sflj,sp_id,status,update_date,xl_bm,xl_dir,xl_name,zdsj,zdsj_actual,zdz_code,zdz_name,ccno,df_auto,fgs_bm,fgs_name,gs_bm,gs_name,online,adjust_exps,reissue,jhlc_orig,sigin_compate,drift_status,cc_service,major_station_name)" +
  427 + " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", new BatchPreparedStatementSetter() {
  428 + @Override
  429 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  430 + ScheduleRealInfo sch = pstList.get(i);
  431 + ps.setLong(1, sch.getId());
  432 + ps.setString(2, sch.getBcType());
  433 + ps.setInt(3, sch.getBcs()==null?0:sch.getBcs());
  434 + ps.setInt(4, sch.getBcsj()==null?0:sch.getBcsj());
  435 + ps.setString(5, sch.getClZbh());
  436 + ps.setTimestamp(6, new java.sql.Timestamp(sch.getCreateDate().getTime()));
  437 + ps.setString(7, sch.getDfsj());
  438 + ps.setInt(8, sch.getDirectiveState());
  439 + ps.setInt(9, sch.getFcno()==null?0:sch.getFcno());
  440 + ps.setString(10, sch.getFcsj());
  441 + ps.setString(11, sch.getFcsjActual());
  442 + ps.setString(12, sch.getjGh());
  443 + ps.setString(13, sch.getjName());
  444 + ps.setDouble(14, sch.getJhlc());
  445 + ps.setString(15, sch.getLpName());
  446 + ps.setString(16, sch.getQdzCode());
  447 + ps.setString(17, sch.getQdzName());
  448 + ps.setString(18, sch.getRealExecDate());
  449 + ps.setString(19, sch.getRemarks());
  450 + ps.setString(20, sch.getsGh());
  451 + ps.setString(21, sch.getsName());
  452 + ps.setTimestamp(22, new java.sql.Timestamp(sch.getScheduleDate().getTime()));
  453 + ps.setString(23, sch.getScheduleDateStr());
  454 + ps.setBoolean(24, sch.isSflj());
  455 + ps.setLong(25, sch.getSpId());
  456 + ps.setInt(26, sch.getStatus());
  457 + ps.setTimestamp(27, new java.sql.Timestamp(sch.getUpdateDate().getTime()));
  458 + ps.setString(28, sch.getXlBm());
  459 + ps.setString(29, sch.getXlDir());
  460 + ps.setString(30, sch.getXlName());
  461 + ps.setString(31, sch.getZdsj());
  462 + ps.setString(32, sch.getZdsjActual());
  463 + ps.setString(33, sch.getZdzCode());
  464 + ps.setString(34, sch.getZdzName());
  465 + ps.setInt(35, sch.getCcno()==null?0:sch.getCcno());
  466 + ps.setBoolean(36, sch.isDfAuto());
  467 + ps.setString(37, sch.getFgsBm());
  468 + ps.setString(38, sch.getFgsName());
  469 + ps.setString(39, sch.getGsBm());
  470 + ps.setString(40, sch.getGsName());
  471 + ps.setBoolean(41, sch.isOnline());
  472 + ps.setString(42, sch.getAdjustExps());
  473 + ps.setBoolean(43, sch.isReissue());
  474 + ps.setDouble(44, sch.getJhlcOrig());
  475 + ps.setInt(45, sch.getSiginCompate());
  476 + ps.setInt(46, sch.getDriftStatus());
  477 + ps.setBoolean(47, sch.isCcService());
  478 + ps.setString(48, sch.getMajorStationName());
  479 + }
  480 +
  481 + @Override
  482 + public int getBatchSize() {
  483 + return pstList.size();
  484 + }
  485 + });
  486 +
  487 + tran.commit(status);
  488 + }catch (Exception e){
  489 + tran.rollback(status);
  490 + logger.error("real schedule batchSave error...", e);
  491 + }
398 492 // 入库
399   - new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class);
  493 + //new BatchSaveUtils<ScheduleRealInfo>().saveList(list, ScheduleRealInfo.class);
400 494 }
401 495  
402 496 public List<SchedulePlanInfo> cleanSchPlanItr(Iterator<SchedulePlanInfo> itrab) {
... ... @@ -420,7 +514,7 @@ public class DayOfSchedule {
420 514 public List<ScheduleRealInfo> findByLineCode(String lineCode) {
421 515 List<ScheduleRealInfo> rs = new ArrayList<>();
422 516  
423   - Collection<ScheduleRealInfo> schs = id2SchedulMap.values();
  517 + Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
424 518 for (ScheduleRealInfo sch : schs) {
425 519 if (sch.getXlBm().equals(lineCode))
426 520 rs.add(sch);
... ... @@ -435,7 +529,7 @@ public class DayOfSchedule {
435 529 public Map<String, Collection<ScheduleRealInfo>> findByLineCodes(List<String> lineList) {
436 530 ArrayListMultimap<String, ScheduleRealInfo> mMap = ArrayListMultimap.create();
437 531  
438   - Collection<ScheduleRealInfo> schs = id2SchedulMap.values();
  532 + Collection<ScheduleRealInfo> schs = nbbmScheduleMap.values();
439 533 for (ScheduleRealInfo sch : schs) {
440 534 if (lineList.contains(sch.getXlBm())) {
441 535 mMap.put(sch.getXlBm(), sch);
... ... @@ -489,27 +583,11 @@ public class DayOfSchedule {
489 583 */
490 584 public ScheduleRealInfo next(ScheduleRealInfo sch) {
491 585 List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
  586 + //排序
  587 + Collections.sort(list, schDFSJComparator);
492 588 return next(list, sch);
493 589 }
494 590  
495   - /**
496   - * 下一个相同走向的班次
497   - *
498   - * @param sch
499   - * @return
500   - */
501   - public ScheduleRealInfo nextSame(final ScheduleRealInfo sch) {
502   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
503   - Collection<ScheduleRealInfo> subList = Collections2.filter(list, new Predicate<ScheduleRealInfo>() {
504   -
505   - @Override
506   - public boolean apply(ScheduleRealInfo item) {
507   - return item.getXlDir().equals(sch.getXlDir());
508   - }
509   - });
510   - return next(subList, sch);
511   - }
512   -
513 591  
514 592 /**
515 593 * 下一个班次
... ... @@ -657,8 +735,7 @@ public class DayOfSchedule {
657 735 .calcRealDate(sch)
658 736 .calcAllTimeByFcsj(sch);
659 737  
660   - String nbbm = sch.getClZbh();
661   - nbbmScheduleMap.put(nbbm, sch);
  738 + nbbmScheduleMap.put(sch.getClZbh(), sch);
662 739  
663 740 //主键索引
664 741 id2SchedulMap.put(sch.getId(), sch);
... ... @@ -675,7 +752,6 @@ public class DayOfSchedule {
675 752 }
676 753  
677 754 public void delete(ScheduleRealInfo sch) {
678   - //ScheduleRealInfo sch = id2SchedulMap.get(id);
679 755 if (!sch.isSflj())
680 756 return;
681 757  
... ... @@ -715,36 +791,6 @@ public class DayOfSchedule {
715 791 return rs;
716 792 }
717 793  
718   - public boolean validTime(ScheduleRealInfo sch, Long ts) {
719   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
720   - int ci = list.indexOf(sch);
721   - ScheduleRealInfo prve, next;
722   - if (ci > 0) {
723   - //之前班次实际时间不能大于该时间
724   - for (int i = ci - 1; i >= 0; i--) {
725   - prve = list.get(i);
726   - if (prve.getZdsjActualTime() != null && prve.getZdsjActualTime() > ts)
727   - return false;
728   -
729   - if (prve.getFcsjActualTime() != null && prve.getFcsjActualTime() > ts)
730   - return false;
731   - }
732   - }
733   -
734   - if (ci < list.size() - 1) {
735   - //之后班次实际时间不能小于该时间
736   - for (int i = ci + 1; i < list.size(); i++) {
737   - next = list.get(i);
738   - if (next.getFcsjActualTime() != null && next.getFcsjActualTime() < ts)
739   - return false;
740   -
741   - if (next.getZdsjActualTime() != null && next.getZdsjActualTime() < ts)
742   - return false;
743   - }
744   - }
745   - return true;
746   - }
747   -
748 794 public void save(ScheduleRealInfo sch) {
749 795 sch.setUpdateDate(new Date());
750 796 pstBuffer.add(sch);
... ... @@ -768,26 +814,6 @@ public class DayOfSchedule {
768 814 return sch;
769 815 }
770 816  
771   - /**
772   - * @Title: nextByBcType
773   - * @Description: TODO(获取下一个指定班次类型的班次)
774   - */
775   - public ScheduleRealInfo nextByBcType(ScheduleRealInfo sch, String bcType) {
776   - List<ScheduleRealInfo> list = nbbmScheduleMap.get(sch.getClZbh());
777   - Collections.sort(list, schFCSJComparator);
778   -
779   - boolean flag = false;
780   - for (ScheduleRealInfo temp : list) {
781   -
782   - if (flag && temp.getBcType().equals(bcType))
783   - return temp;
784   -
785   - if (temp == sch) {
786   - flag = true;
787   - }
788   - }
789   - return null;
790   - }
791 817  
792 818 /**
793 819 * 搜索离当前时间最近的一个指定类型的班次
... ... @@ -857,6 +883,8 @@ public class DayOfSchedule {
857 883 * @return
858 884 */
859 885 public ScheduleRealInfo executeCurr(String nbbm) {
  886 + if(StringUtils.isEmpty(nbbm))
  887 + return null;
860 888 return carExecutePlanMap.get(nbbm);
861 889 }
862 890  
... ... @@ -892,12 +920,12 @@ public class DayOfSchedule {
892 920 }
893 921  
894 922 public void reCalcExecPlan(String nbbm) {
895   - logger.info("reCalcExecPlan...: " + nbbm);
896 923 List<ScheduleRealInfo> list = nbbmScheduleMap.get(nbbm);
897   - Collections.sort(list, schFCSJComparator);
  924 + Collections.sort(list, schDFSJComparator);
898 925  
899 926 ScheduleRealInfo sch = schAttrCalculator.calcCurrentExecSch(list);
900   - carExecutePlanMap.put(nbbm, sch);
  927 + if(null != sch)
  928 + carExecutePlanMap.put(nbbm, sch);
901 929 }
902 930  
903 931 /**
... ... @@ -1026,4 +1054,36 @@ public class DayOfSchedule {
1026 1054 schAttrCalculator.calcQdzTimePlan(new ArrayList<ScheduleRealInfo>(map.get(k)));
1027 1055 }
1028 1056 }
  1057 +
  1058 + public int dbCount(String lineCode, String currSchDate) {
  1059 + int count = -1;
  1060 +
  1061 + try{
  1062 + count = jdbcTemplate.queryForObject("select count(*) from bsth_c_s_sp_info_real where schedule_date='"+currSchDate+"' and xl_bm='"+lineCode+"'", java.lang.Integer.class);
  1063 +
  1064 + }catch (Exception e){
  1065 + logger.error("", e);
  1066 + }
  1067 + return count;
  1068 + }
  1069 +
  1070 + /**
  1071 + * 重新计算ID对照map
  1072 + */
  1073 + public int reCalcIdMaps(){
  1074 + Collection<ScheduleRealInfo> all = findAll();
  1075 + Map<Long, ScheduleRealInfo> id2SchedulMapCopy = new ConcurrentHashMap<>();
  1076 +
  1077 + for(ScheduleRealInfo sch : all){
  1078 + id2SchedulMapCopy.put(sch.getId(), sch);
  1079 + }
  1080 +
  1081 + id2SchedulMap = id2SchedulMapCopy;
  1082 +
  1083 + return id2SchedulMap.size();
  1084 + }
  1085 +
  1086 + public String sizeString(){
  1087 + return id2SchedulMap.size() + "/" + nbbmScheduleMap.size();
  1088 + }
1029 1089 }
1030 1090 \ No newline at end of file
... ...
src/main/java/com/bsth/data/schedule/SchAttrCalculator.java
... ... @@ -206,6 +206,8 @@ public class SchAttrCalculator {
206 206 * @return
207 207 */
208 208 public ScheduleRealInfo calcCurrentExecSch(List<ScheduleRealInfo> list) {
  209 + if(list.size()==0)
  210 + return null;
209 211 String lineCode = list.get(0).getXlBm();
210 212 LineConfig conf = lineConfigData.get(lineCode);
211 213  
... ...
src/main/java/com/bsth/data/schedule/late_adjust/LateAdjustHandle.java
... ... @@ -68,10 +68,17 @@ public class LateAdjustHandle implements ApplicationContextAware{
68 68 ScheduleRealInfo cancel = null;
69 69 //之前存在误点班次没有发出
70 70 ScheduleRealInfo old = lateSchMap.get(sch.getClZbh());
  71 +
71 72 if(old != null && old.getDfsjT() < sch.getDfsjT()){
72   - remove(old);
73   - cancel = old;
74   - logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!");
  73 + //如果之前班次的 待发应到时间已经过了 3 分钟
  74 + long t = System.currentTimeMillis();
  75 + long dfEndTime = old.getDfsjT() + (old.getBcsj() * 60 * 1000);
  76 + if((t - dfEndTime) > 1000 * 60 * 3){
  77 +
  78 + remove(old);
  79 + cancel = old;
  80 + logger.info("【应发未到】old 班次 " + old.getId() + " -被覆盖!");
  81 + }
75 82 }
76 83  
77 84 lateSchMap.put(sch.getClZbh(), sch);
... ... @@ -164,7 +171,7 @@ public class LateAdjustHandle implements ApplicationContextAware{
164 171 }
165 172 }catch (Exception e){
166 173 e.printStackTrace();
167   - logger.error("", e);
  174 + logger.error("late2 car arrive", e);
168 175 }
169 176 }
170 177  
... ...
src/main/java/com/bsth/data/schedule/thread/SchedulePstThread.java
1 1 package com.bsth.data.schedule.thread;
2 2  
3   -import com.alibaba.fastjson.JSON;
4 3 import com.bsth.data.schedule.DayOfSchedule;
5 4 import com.bsth.entity.realcontrol.ScheduleRealInfo;
6 5 import com.bsth.repository.realcontrol.ScheduleRealInfoRepository;
7 6 import org.slf4j.Logger;
8 7 import org.slf4j.LoggerFactory;
9 8 import org.springframework.beans.factory.annotation.Autowired;
10   -import org.springframework.jdbc.core.namedparam.BeanPropertySqlParameterSource;
11   -import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
  9 +import org.springframework.jdbc.core.BatchPreparedStatementSetter;
  10 +import org.springframework.jdbc.core.JdbcTemplate;
  11 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
12 12 import org.springframework.stereotype.Component;
  13 +import org.springframework.transaction.TransactionDefinition;
  14 +import org.springframework.transaction.TransactionStatus;
  15 +import org.springframework.transaction.support.DefaultTransactionDefinition;
  16 +
  17 +import java.sql.PreparedStatement;
  18 +import java.sql.SQLException;
  19 +import java.util.ArrayList;
  20 +import java.util.List;
13 21  
14 22 /**
15 23 * @author PanZhao
... ... @@ -24,67 +32,145 @@ public class SchedulePstThread extends Thread {
24 32 ScheduleRealInfoRepository scheduleRepository;
25 33  
26 34 @Autowired
27   - NamedParameterJdbcTemplate jdbcTemplate;
  35 + JdbcTemplate jdbcTemplate;
28 36  
29 37 @Autowired
30 38 DayOfSchedule dayOfSchedule;
31 39  
32 40 Logger logger = LoggerFactory.getLogger(this.getClass());
33 41  
  42 + static List<ScheduleRealInfo> saveList = new ArrayList<>();
  43 +
34 44 @Override
35 45 public void run() {
36 46  
37   - ScheduleRealInfo schedule;
38   - for (int i = 0; i < 1000; i++) {
39   - schedule = DayOfSchedule.pstBuffer.poll();
40   - if (null == schedule)
41   - break;
  47 + try{
  48 + ScheduleRealInfo schedule;
  49 + for (int i = 0; i < 500; i++) {
  50 + schedule = DayOfSchedule.pstBuffer.poll();
  51 + if (null == schedule)
  52 + break;
42 53  
43   - if (schedule.isDeleted()) {
44   - logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId());
45   - continue;
  54 + if (schedule.isDeleted()) {
  55 + logger.error("save 发现 deleted=true 的班次,id: " + schedule.getId());
  56 + continue;
  57 + }
  58 +
  59 + saveList.add(schedule);
46 60 }
47 61  
48   - save(schedule);
  62 + //写入数据库
  63 + save();
  64 + }catch (Exception e){
  65 + logger.error("", e);
49 66 }
50 67 }
51 68  
52   - /**
53   - * 班次更新到数据库,不走jpa
54   - *
55   - * @param sch
56   - */
57   - public void save(ScheduleRealInfo sch) {
58   - if (sch.getId() == null) {
59   - logger.error("入库的班次没有ID, " + JSON.toJSONString(sch));
60   - return;
  69 +/* PropertyFilter filter = new PropertyFilter() {
  70 + //过滤不需要的字段
  71 + public boolean apply(Object source, String name, Object value) {
  72 + if("cTasks".equals(name)||"createBy".equals(name)||"updateBy".equals(name)){
  73 + return false;
  74 + }
  75 + return true;
61 76 }
  77 + };*/
62 78  
63   - if(sch.getSaveFailCount() > 5){
64   - logger.error("入库失败上限, " + JSON.toJSONString(sch));
  79 + private void save(){
  80 + if(saveList.size() == 0)
65 81 return;
66   - }
  82 + //记录同步数据
  83 + logger.info("real schedule update size: " + saveList.size());
  84 + //logger.info(JSON.toJSONString(saveList, filter));
67 85  
68   - try {
69   - String sql = "UPDATE bsth_c_s_sp_info_real" +
70   - " SET adjust_exps=:adjustExps, bc_type=:bcType, bcs=:bcs, bcsj=:bcsj, ccno=:ccno, cl_zbh=:clZbh, df_auto=:dfAuto," +
71   - " dfsj=:dfsj, directive_state=:directiveState, fcno=:fcno, fcsj=:fcsj, fcsj_actual=:fcsjActual, fgs_bm=:fgsBm, fgs_name=:fgsName, gs_bm=:gsBm, gs_name=:gsName," +
72   - " j_gh=:jGh, j_name=:jName, jhlc=:jhlc, jhlc_orig=:jhlcOrig, lp_name=:lpName, ONLINE=:online, qdz_code=:qdzCode, qdz_name=:qdzName," +
73   - " real_exec_date=:realExecDate, reissue=:reissue, remarks=:remarks, s_gh=:sGh, s_name=:sName, schedule_date=:scheduleDate," +
74   - " schedule_date_str=:scheduleDateStr, sflj=:sflj, sp_id=:spId, STATUS=:status, update_date=:updateDate, xl_bm=:xlBm, xl_dir=:xlDir, xl_name=:xlName," +
75   - " zdsj=:zdsj, zdsj_actual=:zdsjActual, zdz_code=:zdzCode, zdz_name=:zdzName" +
76   - " WHERE " +
77   - " id=:id";
78   -
79   - jdbcTemplate.update(sql, new BeanPropertySqlParameterSource(sch));
80   - sch.setSaveFailCount(0);
81   - } catch (Exception e) {
82   - //下次入库再试
83   - sch.setSaveFailCount(sch.getSaveFailCount()+1);
84   - dayOfSchedule.save(sch);
85   -
86   - logger.error("班次 " + sch.getId() + "入库失败," + JSON.toJSONString(sch));
87   - logger.error("", e);
  86 + //批量入库
  87 + update2Db();
  88 +
  89 + //清空容器
  90 + saveList.clear();
  91 + logger.info("update end! ");
  92 + }
  93 +
  94 + private void update2Db(){
  95 + final List<ScheduleRealInfo> pstList = saveList;
  96 + //编程式事务
  97 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  98 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  99 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  100 + TransactionStatus status = tran.getTransaction(def);
  101 +
  102 + try{
  103 + //更新
  104 + jdbcTemplate.batchUpdate("update bsth_c_s_sp_info_real set bc_type=?,bcs=?,bcsj=?,cl_zbh=?,create_date=?" +
  105 + ",dfsj=?,directive_state=?,fcno=?,fcsj=?,fcsj_actual=?,j_gh=?,j_name=?,jhlc=?,lp_name=?,qdz_code=?" +
  106 + ",qdz_name=?,real_exec_date=?,remarks=?,s_gh=?,s_name=?,schedule_date=?,schedule_date_str=?,sflj=?" +
  107 + ",sp_id=?,status=?,update_date=?,xl_bm=?,xl_dir=?,xl_name=?,zdsj=?,zdsj_actual=?,zdz_code=?,zdz_name=?" +
  108 + ",ccno=?,df_auto=?,fgs_bm=?,fgs_name=?,gs_bm=?,gs_name=?,online=?,adjust_exps=?,reissue=?,jhlc_orig=?" +
  109 + ",sigin_compate=?,drift_status=?,cc_service=?,major_station_name=? where id=?", new BatchPreparedStatementSetter() {
  110 + @Override
  111 + public void setValues(PreparedStatement ps, int i) throws SQLException {
  112 + ScheduleRealInfo sch = pstList.get(i);
  113 + ps.setString(1, sch.getBcType());
  114 + ps.setInt(2, sch.getBcs()==null?0:sch.getBcs());
  115 + ps.setInt(3, sch.getBcsj()==null?0:sch.getBcsj());
  116 + ps.setString(4, sch.getClZbh());
  117 + ps.setTimestamp(5, new java.sql.Timestamp(sch.getCreateDate().getTime()));
  118 + ps.setString(6, sch.getDfsj());
  119 + ps.setInt(7, sch.getDirectiveState());
  120 + ps.setInt(8, sch.getFcno()==null?0:sch.getFcno());
  121 + ps.setString(9, sch.getFcsj());
  122 + ps.setString(10, sch.getFcsjActual());
  123 + ps.setString(11, sch.getjGh());
  124 + ps.setString(12, sch.getjName());
  125 + ps.setDouble(13, sch.getJhlc());
  126 + ps.setString(14, sch.getLpName());
  127 + ps.setString(15, sch.getQdzCode());
  128 + ps.setString(16, sch.getQdzName());
  129 + ps.setString(17, sch.getRealExecDate());
  130 + ps.setString(18, sch.getRemarks());
  131 + ps.setString(19, sch.getsGh());
  132 + ps.setString(20, sch.getsName());
  133 + ps.setTimestamp(21, new java.sql.Timestamp(sch.getScheduleDate().getTime()));
  134 + ps.setString(22, sch.getScheduleDateStr());
  135 + ps.setBoolean(23, sch.isSflj());
  136 + ps.setLong(24, sch.getSpId());
  137 + ps.setInt(25, sch.getStatus());
  138 + ps.setTimestamp(26, new java.sql.Timestamp(sch.getUpdateDate().getTime()));
  139 + ps.setString(27, sch.getXlBm());
  140 + ps.setString(28, sch.getXlDir());
  141 + ps.setString(29, sch.getXlName());
  142 + ps.setString(30, sch.getZdsj());
  143 + ps.setString(31, sch.getZdsjActual());
  144 + ps.setString(32, sch.getZdzCode());
  145 + ps.setString(33, sch.getZdzName());
  146 + ps.setInt(34, sch.getCcno()==null?0:sch.getCcno());
  147 + ps.setBoolean(35, sch.isDfAuto());
  148 + ps.setString(36, sch.getFgsBm());
  149 + ps.setString(37, sch.getFgsName());
  150 + ps.setString(38, sch.getGsBm());
  151 + ps.setString(39, sch.getGsName());
  152 + ps.setBoolean(40, sch.isOnline());
  153 + ps.setString(41, sch.getAdjustExps());
  154 + ps.setBoolean(42, sch.isReissue());
  155 + ps.setDouble(43, sch.getJhlcOrig());
  156 + ps.setInt(44, sch.getSiginCompate());
  157 + ps.setInt(45, sch.getDriftStatus());
  158 + ps.setBoolean(46, sch.isCcService());
  159 + ps.setString(47, sch.getMajorStationName());
  160 +
  161 + ps.setLong(48, sch.getId());
  162 + }
  163 +
  164 + @Override
  165 + public int getBatchSize() {
  166 + return pstList.size();
  167 + }
  168 + });
  169 +
  170 + tran.commit(status);
  171 + }catch (Exception e){
  172 + tran.rollback(status);
  173 + logger.error("同步数据库失败," , e);
88 174 }
89 175 }
90 176 }
... ...
src/main/java/com/bsth/data/schedule/thread/ScheduleRefreshThread.java
... ... @@ -56,7 +56,7 @@ public class ScheduleRefreshThread extends Thread{
56 56  
57 57 if(oldSchDate == null || !oldSchDate.equals(currSchDate)){
58 58  
59   - logger.info(lineCode + "开始翻班, " + currSchDate);
  59 + //logger.info(lineCode + "开始翻班, " + currSchDate);
60 60  
61 61 try{
62 62 //清除指令数据
... ... @@ -74,6 +74,14 @@ public class ScheduleRefreshThread extends Thread{
74 74 //重载排班数据
75 75 dayOfSchedule.reloadSch(lineCode, currSchDate, false);
76 76 logger.info(lineCode + "翻班完成, " + currSchDate + " -班次数量:" + dayOfSchedule.findByLineCode(lineCode).size());
  77 +
  78 +
  79 + //校验一下数据库和缓存的数据
  80 + /*int dbCount = dayOfSchedule.dbCount(lineCode, currSchDate);
  81 + logger.info(lineCode + " 数据库数量:" + dbCount);
  82 + if(dbCount != dayOfSchedule.findByLineCode(lineCode).size()){
  83 + logger.error("异常异常异常,,数据库和缓存数量不一致," + lineCode);
  84 + }*/
77 85 }
78 86 }catch (Exception e){
79 87 logger.error("班次更新失败!! -" + lineCode, e);
... ...
src/main/java/com/bsth/entity/LineVersions.java
... ... @@ -69,6 +69,12 @@ public class LineVersions{
69 69 */
70 70 private int status;
71 71  
  72 + /**
  73 + * 是否发布 int length(1)
  74 + * 0(没有),1(发布)
  75 + */
  76 + private int isupdate;
  77 +
72 78 public Integer getId() {
73 79 return id;
74 80 }
... ... @@ -156,5 +162,13 @@ public class LineVersions{
156 162 public void setStatus(int status) {
157 163 this.status = status;
158 164 }
  165 +
  166 + public int getIsupdate() {
  167 + return isupdate;
  168 + }
  169 +
  170 + public void setIsupdate(int isupdate) {
  171 + this.isupdate = isupdate;
  172 + }
159 173  
160 174 }
161 175 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/geo_data/GeoRoad.java 0 → 100644
  1 +package com.bsth.entity.geo_data;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/12/8.
  9 + */
  10 +public class GeoRoad {
  11 +
  12 + private int id;
  13 +
  14 + private Integer sectionrouteCode;
  15 +
  16 + private Integer directions;
  17 +
  18 + private String lineCode;
  19 +
  20 + private String sectionCode;
  21 +
  22 + private Integer versions;
  23 +
  24 + private String sectionName;
  25 +
  26 + private String crosesRoad;
  27 +
  28 + @JsonIgnore
  29 + private String gsectionVector;
  30 +
  31 + private List<String> bdCoords;
  32 +
  33 + public int getId() {
  34 + return id;
  35 + }
  36 +
  37 + public void setId(int id) {
  38 + this.id = id;
  39 + }
  40 +
  41 + public Integer getSectionrouteCode() {
  42 + return sectionrouteCode;
  43 + }
  44 +
  45 + public void setSectionrouteCode(Integer sectionrouteCode) {
  46 + this.sectionrouteCode = sectionrouteCode;
  47 + }
  48 +
  49 + public Integer getDirections() {
  50 + return directions;
  51 + }
  52 +
  53 + public void setDirections(Integer directions) {
  54 + this.directions = directions;
  55 + }
  56 +
  57 + public String getLineCode() {
  58 + return lineCode;
  59 + }
  60 +
  61 + public void setLineCode(String lineCode) {
  62 + this.lineCode = lineCode;
  63 + }
  64 +
  65 + public String getSectionCode() {
  66 + return sectionCode;
  67 + }
  68 +
  69 + public void setSectionCode(String sectionCode) {
  70 + this.sectionCode = sectionCode;
  71 + }
  72 +
  73 + public Integer getVersions() {
  74 + return versions;
  75 + }
  76 +
  77 + public void setVersions(Integer versions) {
  78 + this.versions = versions;
  79 + }
  80 +
  81 + public String getSectionName() {
  82 + return sectionName;
  83 + }
  84 +
  85 + public void setSectionName(String sectionName) {
  86 + this.sectionName = sectionName;
  87 + }
  88 +
  89 + public String getCrosesRoad() {
  90 + return crosesRoad;
  91 + }
  92 +
  93 + public void setCrosesRoad(String crosesRoad) {
  94 + this.crosesRoad = crosesRoad;
  95 + }
  96 +
  97 + public String getGsectionVector() {
  98 + return gsectionVector;
  99 + }
  100 +
  101 + public void setGsectionVector(String gsectionVector) {
  102 + this.gsectionVector = gsectionVector;
  103 + }
  104 +
  105 + public List<String> getBdCoords() {
  106 + return bdCoords;
  107 + }
  108 +
  109 + public void setBdCoords(List<String> bdCoords) {
  110 + this.bdCoords = bdCoords;
  111 + }
  112 +}
... ...
src/main/java/com/bsth/entity/geo_data/GeoStation.java 0 → 100644
  1 +package com.bsth.entity.geo_data;
  2 +
  3 +import com.fasterxml.jackson.annotation.JsonIgnore;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/12/7.
  9 + */
  10 +public class GeoStation {
  11 +
  12 + private int id;
  13 +
  14 + private String stationName;
  15 +
  16 + private String stationRouteCode;
  17 +
  18 + private String lineCode;
  19 +
  20 + private Integer directions;
  21 +
  22 + private String stationCode;
  23 +
  24 + private String stationMark;
  25 +
  26 + private Integer version;
  27 +
  28 + private Float gLonx;
  29 +
  30 + private Float gLaty;
  31 +
  32 + @JsonIgnore
  33 + private String gPolygonGrid;
  34 +
  35 + private List<String> bdCoords;
  36 +
  37 + private Integer radius;
  38 +
  39 + private String shapesType;
  40 +
  41 + public int getId() {
  42 + return id;
  43 + }
  44 +
  45 + public void setId(int id) {
  46 + this.id = id;
  47 + }
  48 +
  49 + public String getStationName() {
  50 + return stationName;
  51 + }
  52 +
  53 + public void setStationName(String stationName) {
  54 + this.stationName = stationName;
  55 + }
  56 +
  57 + public String getStationRouteCode() {
  58 + return stationRouteCode;
  59 + }
  60 +
  61 + public void setStationRouteCode(String stationRouteCode) {
  62 + this.stationRouteCode = stationRouteCode;
  63 + }
  64 +
  65 + public String getLineCode() {
  66 + return lineCode;
  67 + }
  68 +
  69 + public void setLineCode(String lineCode) {
  70 + this.lineCode = lineCode;
  71 + }
  72 +
  73 + public Integer getDirections() {
  74 + return directions;
  75 + }
  76 +
  77 + public void setDirections(Integer directions) {
  78 + this.directions = directions;
  79 + }
  80 +
  81 + public String getStationCode() {
  82 + return stationCode;
  83 + }
  84 +
  85 + public void setStationCode(String stationCode) {
  86 + this.stationCode = stationCode;
  87 + }
  88 +
  89 + public String getStationMark() {
  90 + return stationMark;
  91 + }
  92 +
  93 + public void setStationMark(String stationMark) {
  94 + this.stationMark = stationMark;
  95 + }
  96 +
  97 + public Integer getVersion() {
  98 + return version;
  99 + }
  100 +
  101 + public void setVersion(Integer version) {
  102 + this.version = version;
  103 + }
  104 +
  105 + public Float getgLonx() {
  106 + return gLonx;
  107 + }
  108 +
  109 + public void setgLonx(Float gLonx) {
  110 + this.gLonx = gLonx;
  111 + }
  112 +
  113 + public Float getgLaty() {
  114 + return gLaty;
  115 + }
  116 +
  117 + public void setgLaty(Float gLaty) {
  118 + this.gLaty = gLaty;
  119 + }
  120 +
  121 + public String getgPolygonGrid() {
  122 + return gPolygonGrid;
  123 + }
  124 +
  125 + public void setgPolygonGrid(String gPolygonGrid) {
  126 + this.gPolygonGrid = gPolygonGrid;
  127 + }
  128 +
  129 + public Integer getRadius() {
  130 + return radius;
  131 + }
  132 +
  133 + public void setRadius(Integer radius) {
  134 + this.radius = radius;
  135 + }
  136 +
  137 + public String getShapesType() {
  138 + return shapesType;
  139 + }
  140 +
  141 + public void setShapesType(String shapesType) {
  142 + this.shapesType = shapesType;
  143 + }
  144 +
  145 + public List<String> getBdCoords() {
  146 + return bdCoords;
  147 + }
  148 +
  149 + public void setBdCoords(List<String> bdCoords) {
  150 + this.bdCoords = bdCoords;
  151 + }
  152 +}
0 153 \ No newline at end of file
... ...
src/main/java/com/bsth/entity/oil/Dlb.java
... ... @@ -73,7 +73,7 @@ public class Dlb {
73 73 private String fgsname;
74 74  
75 75  
76   - private String lp;
  76 + private String lp="";
77 77  
78 78 public Integer getId() {
79 79 return id;
... ...
src/main/java/com/bsth/entity/oil/Nylog.java 0 → 100644
  1 +package com.bsth.entity.oil;
  2 +
  3 +import java.util.Date;
  4 +
  5 +import javax.persistence.Entity;
  6 +import javax.persistence.GeneratedValue;
  7 +import javax.persistence.Id;
  8 +import javax.persistence.Table;
  9 +
  10 +@Entity
  11 +@Table(name = "bsth_c_nylog")
  12 +public class Nylog {
  13 + @Id
  14 + @GeneratedValue
  15 + private Integer id;
  16 +
  17 + private String nylx;
  18 +
  19 + private String czmc;
  20 +
  21 + private String userid;
  22 +
  23 + private String username;
  24 +
  25 + private Date createdate;
  26 +
  27 + private String cxtj;
  28 +
  29 + private String fwdz;
  30 +
  31 + public Integer getId() {
  32 + return id;
  33 + }
  34 +
  35 + public void setId(Integer id) {
  36 + this.id = id;
  37 + }
  38 +
  39 + public String getNylx() {
  40 + return nylx;
  41 + }
  42 +
  43 + public void setNylx(String nylx) {
  44 + this.nylx = nylx;
  45 + }
  46 +
  47 + public String getCzmc() {
  48 + return czmc;
  49 + }
  50 +
  51 + public void setCzmc(String czmc) {
  52 + this.czmc = czmc;
  53 + }
  54 +
  55 + public String getUserid() {
  56 + return userid;
  57 + }
  58 +
  59 + public void setUserid(String userid) {
  60 + this.userid = userid;
  61 + }
  62 +
  63 + public String getUsername() {
  64 + return username;
  65 + }
  66 +
  67 + public void setUsername(String username) {
  68 + this.username = username;
  69 + }
  70 +
  71 + public Date getCreatedate() {
  72 + return createdate;
  73 + }
  74 +
  75 + public void setCreatedate(Date createdate) {
  76 + this.createdate = createdate;
  77 + }
  78 +
  79 + public String getCxtj() {
  80 + return cxtj;
  81 + }
  82 +
  83 + public void setCxtj(String cxtj) {
  84 + this.cxtj = cxtj;
  85 + }
  86 +
  87 + public String getFwdz() {
  88 + return fwdz;
  89 + }
  90 +
  91 + public void setFwdz(String fwdz) {
  92 + this.fwdz = fwdz;
  93 + }
  94 +
  95 +
  96 +
  97 +}
... ...
src/main/java/com/bsth/entity/oil/Ylb.java
... ... @@ -56,7 +56,7 @@ public class Ylb {
56 56 //进场顺序(根据最先出场和最后进场来关联车辆的存油量)
57 57 private int jcsx;
58 58  
59   - private String lp;
  59 + private String lp="";
60 60 @Transient
61 61 private String bglyh;
62 62  
... ...
src/main/java/com/bsth/entity/realcontrol/ScheduleRealInfo.java
... ... @@ -24,7 +24,6 @@ import java.util.Set;
24 24 public class ScheduleRealInfo {
25 25 /** 主键Id */
26 26 @Id
27   - @GeneratedValue
28 27 private Long id;
29 28  
30 29 /** 计划ID */
... ...
src/main/java/com/bsth/repository/LineVersionsRepository.java
... ... @@ -73,4 +73,18 @@ public interface LineVersionsRepository extends BaseRepository&lt;LineVersions, Int
73 73 @Query(value = " SELECT lv FROM LineVersions lv where lv.line.id = ?1 and lv.versions = (?2 - "+1+")")
74 74 public LineVersions findBylineIdAndVersions(Integer id, Integer versions);
75 75  
  76 +
  77 + /**
  78 + * 获取线路版本的上一个版本
  79 + */
  80 + @Query(value = " SELECT lv.versions FROM LineVersions lv where lv.line.id = ?1 and lv.status=1")
  81 + public Integer findCurrentVersion(Integer id);
  82 +
  83 + /**
  84 + * 发布版本
  85 + */
  86 + @Transactional
  87 + @Modifying
  88 + @Query(value = "UPDATE LineVersions lv set lv.isupdate=1 where lv.id=?1 ")
  89 + public int issueVersion(int id);
76 90 }
... ...
src/main/java/com/bsth/repository/LsSectionRouteRepository.java
... ... @@ -37,4 +37,11 @@ public interface LsSectionRouteRepository extends BaseRepository&lt;LsSectionRoute,
37 37 @Modifying
38 38 @Query(value="DELETE from bsth_c_ls_sectionroute where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
39 39 public void batchDelete(Integer line, Integer dir, Integer versions);
  40 +
  41 + /**
  42 + * 更新路线前撤销线路版本下历史原有路段路由
  43 + */
  44 + @Modifying
  45 + @Query(value="UPDATE bsth_c_ls_sectionroute set destroy = 1 where line = ?1 and directions = ?2 and versions=?3", nativeQuery=true)
  46 + public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions);
40 47 }
... ...
src/main/java/com/bsth/repository/LsStationRouteRepository.java
... ... @@ -42,4 +42,14 @@ public interface LsStationRouteRepository extends BaseRepository&lt;LsStationRoute,
42 42 @Modifying
43 43 @Query(value="DELETE from bsth_c_ls_stationroute where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true)
44 44 public void batchDelete(Integer line,Integer dir, Integer versions);
  45 +
  46 + /**
  47 + * 更新路线前撤销线路版本号历史原有站点路由
  48 + *
  49 + * @param line
  50 + * @param dir
  51 + */
  52 + @Modifying
  53 + @Query(value="UPDATE bsth_c_ls_stationroute set destroy = 1 where line = ?1 and directions = ?2 and versions = ?3", nativeQuery=true)
  54 + public void batchDestroy(Integer sectionRouteLine, Integer directions, Integer versions);
45 55 }
... ...
src/main/java/com/bsth/repository/SectionRouteCacheRepository.java
... ... @@ -139,4 +139,18 @@ public interface SectionRouteCacheRepository extends BaseRepository&lt;SectionRoute
139 139 @Modifying
140 140 @Query(value="delete from bsth_c_sectionroute_cache where line_code = ?1 and directions = ?2", nativeQuery=true)
141 141 public void sectionRouteCacheDel(String lineCode,Integer dir);
142   -}
  142 +
  143 + @Modifying
  144 + @Query(value="delete from bsth_c_sectionroute_cache where line = ?1 and directions = ?2", nativeQuery=true)
  145 + public void sectionRouteCacheDel(Integer lineId,Integer dir);
  146 +
  147 + /**
  148 + * @Description :TODO(查询线路某方向下的上一个路段序号)
  149 + *
  150 + * @param map <lineId:线路ID; direction:方向;sectionRouteCode:路段编码>
  151 + *
  152 + * @return List<Map<String, Object>>
  153 + */
  154 + @Query(value = " select MAX(r.sectionroute_code) as sectionrouteCode from bsth_c_sectionroute_cache r WHERE r.line=?1 and r.directions =?2 and r.sectionroute_code< ?3 and r.destroy = 0", nativeQuery=true)
  155 + List<Object[]> findCacheUpSectionRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
  156 +}
143 157 \ No newline at end of file
... ...
src/main/java/com/bsth/repository/SectionRouteRepository.java
... ... @@ -202,4 +202,7 @@ public interface SectionRouteRepository extends BaseRepository&lt;SectionRoute, Int
202 202 @Modifying
203 203 @Query(value="delete from SectionRoute sr where sr.line.id = ?1 and sr.lineCode = ?2")
204 204 public void batchDelete(Integer lineId, String lineCode);
  205 +
  206 + @Query("select r from SectionRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.sectionrouteCode")
  207 + public List<SectionRoute> findByLine(Integer lineId, Integer dir);
205 208 }
... ...
src/main/java/com/bsth/repository/StationRouteCacheRepository.java
1 1 package com.bsth.repository;
2 2  
3 3 import java.util.List;
4   -import java.util.Map;
5 4  
6   -import org.springframework.data.domain.Sort;
7   -import org.springframework.data.jpa.domain.Specification;
8 5 import org.springframework.data.jpa.repository.EntityGraph;
9 6 import org.springframework.data.jpa.repository.Modifying;
10 7 import org.springframework.data.jpa.repository.Query;
11 8 import org.springframework.stereotype.Repository;
12 9  
13   -import com.bsth.entity.StationRoute;
14 10 import com.bsth.entity.StationRouteCache;
15   -import com.bsth.entity.search.CustomerSpecs;
16 11  
17 12 /**
18 13 *
... ... @@ -57,12 +52,16 @@ public interface StationRouteCacheRepository extends BaseRepository&lt;StationRoute
57 52 /**
58 53 * 更新路线删除线路缓存站点
59 54 *
60   - * @param line
  55 + * @param lineCode
61 56 * @param dir
62 57 */
63 58 @Modifying
64 59 @Query(value="delete from bsth_c_stationroute_cache where line_code = ?1 and directions = ?2 ", nativeQuery=true)
65 60 public void stationRouteCacheDel(String lineCode,Integer dir);
  61 +
  62 + @Modifying
  63 + @Query(value="delete from bsth_c_stationroute_cache where line = ?1 and directions = ?2 ", nativeQuery=true)
  64 + public void stationRouteCacheDel(Integer lineId,Integer dir);
66 65  
67 66  
68 67 @Query(value = "SELECT a.`stationRoute.id`," +
... ... @@ -137,4 +136,7 @@ public interface StationRouteCacheRepository extends BaseRepository&lt;StationRoute
137 136 "r.line=?1 and r.directions =?2 and station_route_code< ?3 and r.destroy = 0 ) and t.line=?1 and t.directions = ?2 AND t.destroy = 0", nativeQuery=true)
138 137 List<Object[]> findUpStationRouteCode(Integer lineId,Integer direction,Integer stationRouteCode);
139 138  
  139 + @Modifying
  140 + @Query(value="UPDATE bsth_c_stationroute_cache set station_route_code = (station_route_code+10) where line = ?1 and directions = ?2 and station_route_code >=?3 and destroy = 0", nativeQuery=true)
  141 + public void stationUpdStationRouteCode(Integer line,Integer dir,Integer routeCod);
140 142 }
... ...
src/main/java/com/bsth/repository/StationRouteRepository.java
... ... @@ -15,7 +15,6 @@ import org.springframework.transaction.annotation.Transactional;
15 15  
16 16 import com.bsth.entity.Line;
17 17 import com.bsth.entity.StationRoute;
18   -import com.bsth.entity.StationRouteCache;
19 18  
20 19 /**
21 20 *
... ... @@ -189,7 +188,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
189 188 " a.stationRouteUpdateDate," +
190 189 " b.id AS stationId," +
191 190 " b.station_cod AS stationCode," +
192   - " b.station_name AS stationName," +
  191 + " a.stationRouteName," +
193 192 " b.road_coding AS stationRoadCoding," +
194 193 " b.db_type AS stationDbType," +
195 194 " b.b_jwpoints AS stationJwpoints," +
... ... @@ -212,6 +211,7 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
212 211 " FROM ( SELECT s.id AS stationRouteId," +
213 212 " s.line AS stationRouteLine," +
214 213 " s.station as stationRouteStation," +
  214 + " s.station_name AS stationRouteName," +
215 215 " s.station_route_code as stationRouteCode," +
216 216 " s.line_code AS stationRouteLIneCode," +
217 217 " s.station_mark AS stationRouteStationMark," +
... ... @@ -259,6 +259,9 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
259 259 @Query("select r from StationRoute r where r.lineCode=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode")
260 260 List<StationRoute> findByLine(String lineCode, int updown);
261 261  
  262 + @Query("select r from StationRoute r where r.line.id=?1 and r.directions=?2 and r.destroy=0 order by r.stationRouteCode")
  263 + List<StationRoute> findByLine(Integer lineId, Integer dir);
  264 +
262 265 @EntityGraph(value = "stationRoute_station", type = EntityGraph.EntityGraphType.FETCH)
263 266 @Query("select s from StationRoute s where s.destroy=0 and s.lineCode=?1")
264 267 List<StationRoute> findByLineCode(String lineCode);
... ... @@ -285,6 +288,17 @@ public interface StationRouteRepository extends BaseRepository&lt;StationRoute, Int
285 288 "ORDER BY " +
286 289 "lineCode,directions,stationRouteCode")
287 290 List<Map<String, String>> findAllLineWithYgc();
  291 +
  292 + @Query("SELECT new map(" +
  293 + "lineCode as lineCode,directions as directions,stationName as stationName,stationCode as stationCode," +
  294 + "line.linePlayType as linePlayType,s.stationMark as stationMark) " +
  295 + "FROM " +
  296 + "StationRoute s " +
  297 + "WHERE " +
  298 + "s.destroy = 0 and s.lineCode = ?1 " +
  299 + "ORDER BY " +
  300 + "lineCode,directions,stationRouteCode")
  301 + List<Map<String, String>> findLineWithYgcByLine(String lineCode);
288 302  
289 303 @Modifying
290 304 @Query(value="update bsth_c_stationroute set directions = case directions when 1 then 0 when 0 then 1 end where line = ?1 ", nativeQuery=true)
... ...
src/main/java/com/bsth/repository/oil/NylogRepository.java 0 → 100644
  1 +package com.bsth.repository.oil;
  2 +
  3 +
  4 +
  5 +import org.springframework.stereotype.Repository;
  6 +import com.bsth.entity.oil.Nylog;
  7 +import com.bsth.repository.BaseRepository;
  8 +
  9 +@Repository
  10 +public interface NylogRepository extends BaseRepository<Nylog, Integer>{
  11 +}
... ...
src/main/java/com/bsth/repository/oil/YlbRepository.java
... ... @@ -52,7 +52,11 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
52 52 + " order by nbbm , rq desc,jcsx desc",nativeQuery=true)
53 53 List<Ylb> listByRqJcsx(String rq,String gsbm,String fgsbm,String xlbm,String nbbm);
54 54  
55   -
  55 + @Query(value="select * from bsth_c_ylb where rq>=?1 "
  56 + + " and rq<= ?2 and ssgsdm =?3"
  57 + + " and fgsdm =?4 and xlbm like %?5% "
  58 + + " order by nbbm , rq desc,jcsx desc",nativeQuery=true)
  59 + List<Ylb> listByMonthJcsx(String rq,String rq2,String gsbm,String fgsbm,String xlbm);
56 60  
57 61 /**
58 62 * 当天YLB信息
... ... @@ -67,6 +71,11 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
67 71 @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
68 72 + " and fgsdm like %?3%"
69 73 + " and xlbm = ?4 and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
  74 + List<Ylb> obtainYlEq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
  75 +
  76 + @Query(value="SELECT * FROM bsth_c_ylb where to_days(?1)=to_days(rq) and ssgsdm like %?2% "
  77 + + " and fgsdm like %?3%"
  78 + + " and xlbm = ?4 and nbbm like %?5% order by ?6 asc ",nativeQuery=true)
70 79 List<Ylb> obtainYl_eq(String rq,String gsdm,String fgsdm,String xlbm,String nbbm,String px);
71 80  
72 81  
... ... @@ -153,4 +162,6 @@ public interface YlbRepository extends BaseRepository&lt;Ylb, Integer&gt;{
153 162 " yhlx = ?9"+
154 163 " WHERE id = ?1", nativeQuery=true)
155 164 public void ylbUpdate(Integer id,double czyl,double jzyl,double yh, double sh,String shyy,double ns,String rylx,int yhlx);
  165 +
  166 +
156 167 }
... ...
src/main/java/com/bsth/service/LineVersionsService.java
... ... @@ -33,7 +33,12 @@ public interface LineVersionsService extends BaseService&lt;LineVersions, Integer&gt;
33 33 List<LineVersions> lineUpdate();
34 34  
35 35 LineVersions findLineVersionsMax(int lineId);
  36 +
  37 + // 返回当前线路版本
  38 + Integer findCurrentVersion(int lineId);
36 39  
37 40 Map<String, Object> add(Map<String, Object> map);
38 41  
  42 + Map<String, Object> issueVersion(int id);
  43 +
39 44 }
... ...
src/main/java/com/bsth/service/SectionRouteService.java
... ... @@ -61,8 +61,11 @@ public interface SectionRouteService extends BaseService&lt;SectionRoute, Integer&gt;
61 61 */
62 62 List<Map<String, Object>> findUpSectionRouteCode(Map<String, Object> map);
63 63  
  64 + List<Map<String, Object>> findCacheUpSectionRouteCode(Map<String, Object> map);
  65 +
64 66 Map<String, Object> quoteSection(Map<String, Object> map);
65 67  
66 68 void batchUpdate(Integer lineId, String lineCode);
  69 +
67 70  
68 71 }
... ...
src/main/java/com/bsth/service/StationService.java
... ... @@ -52,6 +52,8 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; {
52 52 */
53 53 Map<String, Object> stationSaveMap(Map<String, Object> map);
54 54  
  55 + Map<String, Object> stationCacheSave(Map<String, Object> map);
  56 +
55 57 /**
56 58 * @Description :TODO(更新站点保存)
57 59 *
... ... @@ -83,5 +85,8 @@ public interface StationService extends BaseService&lt;Station, Integer&gt; {
83 85 Map<String, Object> cacheSave(Map<String, Object> map);
84 86  
85 87 Map<String, Object> stationCacheUpdate(Map<String, Object> map);
  88 +
  89 + Map<String, Object> referenceCurrentVersion(Map<String, Object> map);
  90 +
86 91  
87 92 }
... ...
src/main/java/com/bsth/service/calc/impl/CalcWaybillServiceImpl.java
... ... @@ -69,7 +69,7 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
69 69 return newMap;
70 70 }
71 71  
72   - String sql = "select c.id,c.out_config,c.start_opt,c.trust,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id";
  72 + String sql = "select c.id,c.out_config,c.start_opt,t.line_code from bsth_c_line_config c LEFT JOIN bsth_c_line t on c.line=t.id";
73 73 if(line.length() != 0){
74 74 sql += " where t.line_code = " + line;
75 75 }
... ... @@ -82,7 +82,6 @@ public class CalcWaybillServiceImpl extends BaseServiceImpl&lt;CalcWaybill, Integer
82 82 m.put("id", rs.getLong("id"));
83 83 m.put("out_config", rs.getString("out_config"));
84 84 m.put("start_opt", rs.getString("start_opt"));
85   - m.put("trust", rs.getString("trust"));
86 85 m.put("line_code", rs.getString("line_code"));
87 86 return m;
88 87 }});
... ...
src/main/java/com/bsth/service/forms/FormsService.java
... ... @@ -31,6 +31,7 @@ public interface FormsService {
31 31  
32 32 public List<Singledata> singledata(Map<String, Object> map);
33 33 public List<Singledata> singledatanew(Map<String, Object> map);
  34 + public List<Singledata> singledatatj(Map<String, Object> map);
34 35  
35 36 public List<Vehicleloading> vehicleloading(String line,String data);
36 37  
... ...
src/main/java/com/bsth/service/forms/impl/FormsServiceImpl.java
... ... @@ -441,7 +441,7 @@ public class FormsServiceImpl implements FormsService {
441 441 + " r.cl_zbh,r.xl_bm, r.j_gh,r.gs_bm,r.fgs_bm,r.lp_name "
442 442 + "FROM bsth_c_s_sp_info_real r where 1=1 "
443 443 + " and r.schedule_date_str='"+date + "' "
444   - + " and r.xl_bm like '%"+line+"%' "
  444 + + " and r.xl_bm = '"+line+"' "
445 445 + " and r.gs_bm like '%"+gsdmShif+"%' "
446 446 + " and r.fgs_bm like '%"+fgsdmShif+"%' ) t"
447 447 + " GROUP BY t.schedule_date,t.j_name,t.s_name, "
... ... @@ -473,7 +473,8 @@ public class FormsServiceImpl implements FormsService {
473 473 Shifday d=list.get(i);
474 474 for (int j = 0; j < lists.size(); j++) {
475 475 ScheduleRealInfo s=lists.get(j);
476   - if(d.getJgh().equals(s.getjGh()) && d.getCarPlate().equals(s.getClZbh())){
  476 + if(d.getJgh().equals(s.getjGh()) && d.getCarPlate().equals(s.getClZbh())
  477 + &&d.getLpName().equals(s.getLpName())){
477 478 sList.add(s);
478 479 Set<ChildTaskPlan> cts = s.getcTasks();
479 480 if(cts != null && cts.size() > 0){
... ... @@ -492,7 +493,10 @@ public class FormsServiceImpl implements FormsService {
492 493 double ljgl=culateMileageService.culateLjgl(list_s);
493 494 double sjgl=culateMileageService.culateSjgl(list_s);
494 495 double zyygl=Arith.add(ljgl, sjgl);
495   - double jhgl=culateMileageService.culateJhgl(sList);
  496 + double jhyygl=culateMileageService.culateJhgl(sList);
  497 + double jhjccgl=culateMileageService.culateJhJccgl(sList);
  498 + double jhzgl=Arith.add(jhyygl, jhjccgl);
  499 +
496 500 double cjgl=culateMileageService.culateLbgl(sList);
497 501 int jhbc=culateMileageService.culateJhbc(sList,"");
498 502 int cjbc=culateMileageService.culateLbbc(sList);
... ... @@ -502,9 +506,9 @@ public class FormsServiceImpl implements FormsService {
502 506 d.setEmptMileage(String.valueOf(zksgl));//空驶公里
503 507 d.setTotalm(String.valueOf(Arith.add(zksgl, zyygl)));//总公里
504 508 d.setSjbc(String.valueOf(sjbc+ljbc));
505   - d.setJhlc(String.valueOf(jhgl));//计划里程
  509 + d.setJhlc(String.valueOf(jhzgl));//计划里程
506 510 d.setYygl(String.valueOf(zyygl));//运营公里
507   - d.setSjjhlc(String.valueOf(sjgl));//实际计划里程
  511 + d.setSjjhlc(String.valueOf(jhyygl));//实际计划里程
508 512 d.setRemMileage(String.valueOf(cjgl));//抽减里程
509 513 d.setJhbc(String.valueOf(jhbc));//计划班次
510 514 d.setCjbc(String.valueOf(cjbc));//抽检班次
... ... @@ -629,6 +633,532 @@ public class FormsServiceImpl implements FormsService {
629 633  
630 634  
631 635 // 路单数据
  636 + @Override
  637 + public List<Singledata> singledatatj(Map<String, Object> map) {
  638 + String gsdm="";
  639 + if(map.get("gsdmSing")!=null){
  640 + gsdm=map.get("gsdmSing").toString();
  641 + }
  642 + String fgsdm="";
  643 + if(map.get("fgsdmSing")!=null){
  644 + fgsdm=map.get("fgsdmSing").toString();
  645 + }
  646 +
  647 + String tjtype=map.get("tjtype").toString();
  648 + String xlbm=map.get("line").toString().trim();
  649 + startDate = map.get("startDate").toString();
  650 +
  651 + List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>();
  652 + if(xlbm.equals("")){
  653 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate);
  654 + }else{
  655 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate);
  656 + }
  657 + List<Singledata> list=new ArrayList<Singledata>();
  658 + List<Singledata> list_=new ArrayList<Singledata>();
  659 + if(tjtype.equals("jsy")){
  660 + //油统计
  661 + String sql="select r.j_gh, r.xl_bm,r.cl_zbh"
  662 + + " from bsth_c_s_sp_info_real r where "
  663 + + " r.schedule_date_str = '"+startDate+"'";
  664 + if(xlbm.equals("")){
  665 + sql +="and r.gs_bm='"+gsdm+"' "
  666 + + " and r.fgs_bm='"+fgsdm+"'";
  667 + }else{
  668 + sql += " and r.xl_bm = '"+xlbm+"'";
  669 + }
  670 + sql += " group by r.j_gh,r.xl_bm,r.cl_zbh order by r.xl_bm,r.cl_zbh";
  671 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  672 + @Override
  673 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  674 + Singledata sin = new Singledata();
  675 + sin.setxL(arg0.getString("xl_bm"));
  676 + sin.setJsy(arg0.getString("j_gh"));
  677 + sin.setClzbh(arg0.getString("cl_zbh"));
  678 + return sin;
  679 + }
  680 + });
  681 + String linesql="";
  682 + if(!xlbm.equals("")){
  683 + linesql +=" and xlbm ='"+xlbm+"' ";
  684 + }
  685 + String nysql="SELECT id,xlbm,nbbm, jsy,jzl as jzl,yh as yh,sh as sh FROM bsth_c_ylb "
  686 + + " WHERE rq = '"+startDate+"'"
  687 + + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'" +linesql
  688 + + " union"
  689 + + " SELECT id,xlbm,nbbm,jsy,cdl as jzl,hd as yh,sh as sh FROM bsth_c_dlb"
  690 + + " WHERE rq = '"+startDate+"'"
  691 + + " AND ssgsdm = '"+gsdm+"' AND fgsdm = '"+fgsdm+"'"+linesql;
  692 + List<Singledata> listNy = jdbcTemplate.query(nysql, new RowMapper<Singledata>() {
  693 + @Override
  694 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  695 + Singledata sin = new Singledata();
  696 + sin.setxL(arg0.getString("xlbm"));
  697 + sin.setJsy(arg0.getString("jsy"));
  698 + sin.setClzbh(arg0.getString("nbbm"));
  699 + sin.setJzl(arg0.getString("jzl"));
  700 + sin.setHyl(arg0.getString("yh"));
  701 + sin.setUnyyyl(arg0.getString("sh"));
  702 + return sin;
  703 + }
  704 + });
  705 + //统计油,电表中手动添加的或者有加注没里程的数据
  706 + for (int i = 0; i < listNy.size(); i++) {
  707 + Singledata sin_=listNy.get(i);
  708 + String jsy=sin_.getJsy();
  709 + String line=sin_.getxL();
  710 + String clzbh=sin_.getClzbh();
  711 + boolean fages=true;
  712 + for (int j = 0; j < list.size(); j++) {
  713 + Singledata sin=list.get(j);
  714 + String jsy_=sin.getJsy();
  715 + String line_=sin.getxL();
  716 + String clzbh_=sin.getClzbh();
  717 + if(jsy.equals(jsy_)
  718 + &&line.equals(line_)
  719 + &&clzbh.equals(clzbh_)){
  720 + fages=false;
  721 + }
  722 + }
  723 + if(fages){
  724 + Singledata s=new Singledata();
  725 + s.setJsy(jsy);
  726 + s.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  727 + s.setClzbh(clzbh);
  728 + s.setSgh("");
  729 + s.setsName("");
  730 + s.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  731 + s.setxL(line);
  732 + s.setXlmc(BasicData.lineCode2NameMap.get(line));
  733 + s.setJzl(sin_.getJzl());
  734 + s.setHyl(sin_.getHyl());
  735 + s.setUnyyyl(sin_.getUnyyyl());
  736 + s.setJhlc("0.0");
  737 + s.setEmptMileage("0.0");
  738 + s.setJhjl("0.0");
  739 + s.setrQ(startDate);
  740 + list_.add(s);
  741 + }
  742 + }
  743 + for (int i= 0; i < list.size(); i++) {
  744 + Singledata sin=list.get(i);
  745 + String jsy=sin.getJsy();
  746 + String line=sin.getxL();
  747 + String clzbh=sin.getClzbh();
  748 + double jzl=0.0;
  749 + double yh=0.0;
  750 + double sh=0.0;
  751 + for (int j = 0; j < listNy.size(); j++) {
  752 + Singledata y=listNy.get(j);
  753 + if(y.getJsy().equals(jsy)
  754 + &&y.getClzbh().equals(clzbh)
  755 + &&y.getxL().equals(line)){
  756 + jzl=Arith.add(jzl, y.getJzl());
  757 + yh=Arith.add(yh, y.getHyl());
  758 + sh=Arith.add(sh, y.getUnyyyl());
  759 + }
  760 + }
  761 + sin.setHyl(String.valueOf(yh));
  762 + sin.setJzl(String.valueOf(jzl));
  763 + sin.setUnyyyl(String.valueOf(sh));
  764 +
  765 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  766 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  767 + for (int j = 0; j < listReal.size(); j++) {
  768 + ScheduleRealInfo s=listReal.get(j);
  769 + if(s.getjGh().equals(jsy)
  770 + && s.getClZbh().equals(clzbh)
  771 + &&s.getXlBm().equals(line)){
  772 + newList.add(s);
  773 + Set<ChildTaskPlan> cts = s.getcTasks();
  774 + if(cts != null && cts.size() > 0){
  775 + newList_.add(s);
  776 + }else{
  777 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  778 + newList_.add(s);
  779 + }
  780 + }
  781 + }
  782 + }
  783 + double jhgl=culateMileageService.culateJhgl(newList);
  784 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  785 + double yygl=culateMileageService.culateSjgl(newList_);
  786 + double ljgl=culateMileageService.culateLjgl(newList_);
  787 + double ksgl=culateMileageService.culateKsgl(newList_);
  788 + double jcgl=culateMileageService.culateJccgl(newList_);
  789 +
  790 + double zyygl=Arith.add(yygl, ljgl);
  791 + double zksgl=Arith.add(ksgl, jcgl);
  792 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  793 + sin.setEmptMileage(String.valueOf(zksgl));
  794 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  795 + sin.setXlmc(BasicData.lineCode2NameMap.get(line));
  796 + sin.setrQ(startDate);
  797 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  798 + sin.setSgh("");
  799 + sin.setsName("");
  800 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  801 + list_.add(sin);
  802 +
  803 + }
  804 + Collections.sort(list_,new SingledataByXlbm());
  805 + }else{
  806 + String sql="select r.s_gh,r.s_name, "
  807 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
  808 + + " from bsth_c_s_sp_info_real r where "
  809 + + " r.schedule_date_str = '"+startDate+"'"
  810 + + " and r.s_gh !='' and r.s_gh is not null ";
  811 + if(xlbm.equals("")){
  812 + sql +="and r.gs_bm='"+gsdm+"' "
  813 + + " and r.fgs_bm='"+fgsdm+"'";
  814 + }else{
  815 + sql += " and r.xl_bm = '"+xlbm+"'";
  816 + }
  817 + sql += " group by r.s_gh,r.s_name,"
  818 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  819 +
  820 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  821 + //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  822 + @Override
  823 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  824 + Singledata sin = new Singledata();
  825 + sin.setrQ(startDate);
  826 + sin.setxL(arg0.getString("xl_bm"));
  827 + sin.setClzbh(arg0.getString("cl_zbh"));
  828 + sin.setSgh(arg0.getString("s_gh"));
  829 + sin.setsName(arg0.getString("s_name"));
  830 + return sin;
  831 + }
  832 + });
  833 +
  834 + for (int i = 0; i < list.size(); i++) {
  835 + Singledata sin=list.get(i);
  836 + String jsy=sin.getSgh();
  837 + String line=sin.getxL();
  838 + String clzbh=sin.getClzbh();
  839 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  840 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  841 +
  842 + for (int j = 0; j < listReal.size(); j++) {
  843 + ScheduleRealInfo s=listReal.get(j);
  844 + if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh)
  845 + &&s.getXlBm().equals(line)){
  846 + newList.add(s);
  847 + Set<ChildTaskPlan> cts = s.getcTasks();
  848 + if(cts != null && cts.size() > 0){
  849 + newList_.add(s);
  850 + }else{
  851 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  852 + newList_.add(s);
  853 + }
  854 + }
  855 + }
  856 + }
  857 + double jhgl=culateMileageService.culateJhgl(newList);
  858 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  859 + double yygl=culateMileageService.culateSjgl(newList_);
  860 + double ljgl=culateMileageService.culateLjgl(newList_);
  861 + double ksgl=culateMileageService.culateKsgl(newList_);
  862 + double jcgl=culateMileageService.culateJccgl(newList_);
  863 +
  864 + double zyygl=Arith.add(yygl, ljgl);
  865 + double zksgl=Arith.add(ksgl, jcgl);
  866 +
  867 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  868 +
  869 + sin.setEmptMileage(String.valueOf(zksgl));
  870 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  871 + sin.setxL(BasicData.lineCode2NameMap.get(line));
  872 + sin.setClzbh(clzbh);
  873 + sin.setJsy("");
  874 + sin.setjName("");
  875 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  876 + sin.setHyl("");
  877 + sin.setJzl("");
  878 + sin.setUnyyyl("");
  879 + }
  880 + Collections.sort(list,new SingledataByXlbm());
  881 + }
  882 + return list_;
  883 + }
  884 +
  885 + /*// 路单数据
  886 + @Override
  887 + public List<Singledata> singledatatj(Map<String, Object> map) {
  888 +
  889 + String gsdm="";
  890 + if(map.get("gsdmSing")!=null){
  891 + gsdm=map.get("gsdmSing").toString();
  892 + }
  893 + String fgsdm="";
  894 + if(map.get("fgsdmSing")!=null){
  895 + fgsdm=map.get("fgsdmSing").toString();
  896 + }
  897 +
  898 + String tjtype=map.get("tjtype").toString();
  899 + String xlbm=map.get("line").toString().trim();
  900 + startDate = map.get("startDate").toString();
  901 +
  902 + List<ScheduleRealInfo> listReal=new ArrayList<ScheduleRealInfo>();
  903 + if(xlbm.equals("")){
  904 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineByGs_(gsdm, fgsdm, startDate);
  905 + }else{
  906 + listReal=scheduleRealInfoRepository.scheduleByDateAndLineQp(xlbm, startDate);
  907 + }
  908 + List<Singledata> list=new ArrayList<Singledata>();
  909 + List<Singledata> listY=new ArrayList<Singledata>();
  910 + List<Singledata> listD=new ArrayList<Singledata>();
  911 +
  912 + if(tjtype.equals("jsy")){
  913 + //油统计
  914 + String sql="select xlbm,nbbm,jsy from bsth_c_ylb where rq='"+startDate+"'";
  915 + if(xlbm.equals("")){
  916 + sql += " and ssgsdm= '"+gsdm+"' and fgsdm= '"+fgsdm+"'";
  917 + }else{
  918 + sql +=" and xlbm= '"+xlbm+"'";
  919 + }
  920 + sql += " group by xlbm,nbbm,jsy";
  921 + listY = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  922 + @Override
  923 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  924 + Singledata sin = new Singledata();
  925 + sin.setxL(arg0.getString("xlbm"));
  926 + sin.setJsy(arg0.getString("jsy"));
  927 + sin.setClzbh(arg0.getString("nbbm"));
  928 + return sin;
  929 + }
  930 + });
  931 +
  932 + List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
  933 + for (int i = 0; i < listY.size(); i++) {
  934 + Singledata sin=listY.get(i);
  935 + String jsy=sin.getJsy();
  936 + String line=sin.getxL();
  937 + String clzbh=sin.getClzbh();
  938 +
  939 + double jzl=0.0;
  940 + double yh=0.0;
  941 + double sh=0.0;
  942 + for (int j = 0; j < listYlb.size(); j++) {
  943 + Ylb y=listYlb.get(j);
  944 + if(y.getJsy().equals(jsy)
  945 + &&y.getNbbm().equals(clzbh)
  946 + &&y.getXlbm().equals(line)){
  947 + jzl=Arith.add(jzl, y.getJzl());
  948 + yh=Arith.add(yh, y.getYh());
  949 + sh=Arith.add(sh, y.getSh());
  950 + }
  951 + }
  952 + sin.setHyl(String.valueOf(yh));
  953 + sin.setJzl(String.valueOf(jzl));
  954 + sin.setUnyyyl(String.valueOf(sh));
  955 +
  956 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  957 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  958 + for (int j = 0; j < listReal.size(); j++) {
  959 + ScheduleRealInfo s=listReal.get(j);
  960 + if(s.getjGh().equals(jsy)
  961 + && s.getClZbh().equals(clzbh)
  962 + &&s.getXlBm().equals(line)){
  963 + newList.add(s);
  964 + Set<ChildTaskPlan> cts = s.getcTasks();
  965 + if(cts != null && cts.size() > 0){
  966 + newList_.add(s);
  967 + }else{
  968 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  969 + newList_.add(s);
  970 + }
  971 + }
  972 + }
  973 + }
  974 + double jhgl=culateMileageService.culateJhgl(newList);
  975 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  976 + double yygl=culateMileageService.culateSjgl(newList_);
  977 + double ljgl=culateMileageService.culateLjgl(newList_);
  978 + double ksgl=culateMileageService.culateKsgl(newList_);
  979 + double jcgl=culateMileageService.culateJccgl(newList_);
  980 +
  981 + double zyygl=Arith.add(yygl, ljgl);
  982 + double zksgl=Arith.add(ksgl, jcgl);
  983 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  984 + sin.setEmptMileage(String.valueOf(zksgl));
  985 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  986 + sin.setXlmc(BasicData.lineCode2NameMap.get(line));
  987 + sin.setrQ(startDate);
  988 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  989 + sin.setSgh("");
  990 + sin.setsName("");
  991 + }
  992 +
  993 +
  994 + //电量计算
  995 + String sqldl="select xlbm,nbbm,jsy from bsth_c_dlb where rq='"+startDate+"'";
  996 + if(xlbm.equals("")){
  997 + sqldl += " and ssgsdm= '"+gsdm+"' and fgsdm= '"+fgsdm+"'";
  998 + }else{
  999 + sqldl +=" and xlbm= '"+xlbm+"'";
  1000 + }
  1001 + sqldl += " group by xlbm,nbbm,jsy";
  1002 + listD = jdbcTemplate.query(sqldl, new RowMapper<Singledata>() {
  1003 + @Override
  1004 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  1005 + Singledata sin = new Singledata();
  1006 + sin.setxL(arg0.getString("xlbm"));
  1007 + sin.setJsy(arg0.getString("jsy"));
  1008 + sin.setClzbh(arg0.getString("nbbm"));
  1009 + return sin;
  1010 + }
  1011 + });
  1012 + List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
  1013 +
  1014 + for (int i = 0; i < listD.size(); i++) {
  1015 + Singledata sin=listD.get(i);
  1016 + String jsy=sin.getJsy();
  1017 + String line=sin.getxL();
  1018 + String clzbh=sin.getClzbh();
  1019 +
  1020 + double jzl=0.0;
  1021 + double yh=0.0;
  1022 + double sh=0.0;
  1023 + for (int j = 0; j < listDlb.size(); j++) {
  1024 + Dlb d=listDlb.get(j);
  1025 + if(d.getJsy().equals(jsy)
  1026 + &&d.getNbbm().equals(clzbh)
  1027 + &&d.getXlbm().equals(line)){
  1028 + jzl=Arith.add(jzl, d.getCdl());
  1029 + yh=Arith.add(yh, d.getHd());
  1030 + sh=Arith.add(sh, d.getSh());
  1031 + }
  1032 + }
  1033 + sin.setHyl(String.valueOf(yh));
  1034 + sin.setJzl(String.valueOf(jzl));
  1035 + sin.setUnyyyl(String.valueOf(sh));
  1036 +
  1037 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  1038 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  1039 + for (int j = 0; j < listReal.size(); j++) {
  1040 + ScheduleRealInfo s=listReal.get(j);
  1041 + if(s.getjGh().equals(jsy)
  1042 + && s.getClZbh().equals(clzbh)
  1043 + &&s.getXlBm().equals(line)){
  1044 + newList.add(s);
  1045 + Set<ChildTaskPlan> cts = s.getcTasks();
  1046 + if(cts != null && cts.size() > 0){
  1047 + newList_.add(s);
  1048 + }else{
  1049 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  1050 + newList_.add(s);
  1051 + }
  1052 + }
  1053 + }
  1054 + }
  1055 + double jhgl=culateMileageService.culateJhgl(newList);
  1056 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  1057 + double yygl=culateMileageService.culateSjgl(newList_);
  1058 + double ljgl=culateMileageService.culateLjgl(newList_);
  1059 + double ksgl=culateMileageService.culateKsgl(newList_);
  1060 + double jcgl=culateMileageService.culateJccgl(newList_);
  1061 +
  1062 + double zyygl=Arith.add(yygl, ljgl);
  1063 + double zksgl=Arith.add(ksgl, jcgl);
  1064 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  1065 + sin.setEmptMileage(String.valueOf(zksgl));
  1066 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  1067 + sin.setXlmc(BasicData.lineCode2NameMap.get(line));
  1068 + sin.setrQ(startDate);
  1069 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1070 + sin.setSgh("");
  1071 + sin.setsName("");
  1072 + }
  1073 +
  1074 +
  1075 + Collections.sort(listY,new SingledataByXlbm());
  1076 + Collections.sort(listD,new SingledataByXlbm());
  1077 + list.addAll(listY);
  1078 + list.addAll(listD);
  1079 + }else{
  1080 + String sql="select r.s_gh,r.s_name, "
  1081 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm"
  1082 + + " from bsth_c_s_sp_info_real r where "
  1083 + + " r.schedule_date_str = '"+startDate+"'"
  1084 + + " and r.s_gh !='' and r.s_gh is not null ";
  1085 + if(xlbm.equals("")){
  1086 + sql +="and r.gs_bm='"+gsdm+"' "
  1087 + + " and r.fgs_bm='"+fgsdm+"'";
  1088 + }else{
  1089 + sql += " and r.xl_bm = '"+xlbm+"'";
  1090 + }
  1091 + sql += " group by r.s_gh,r.s_name,"
  1092 + + " r.xl_bm,r.cl_zbh,r.gs_bm,r.fgs_bm order by r.xl_bm,r.cl_zbh";
  1093 +
  1094 + list = jdbcTemplate.query(sql, new RowMapper<Singledata>() {
  1095 + //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
  1096 + @Override
  1097 + public Singledata mapRow(ResultSet arg0, int arg1) throws SQLException {
  1098 + Singledata sin = new Singledata();
  1099 + sin.setrQ(startDate);
  1100 + sin.setxL(arg0.getString("xl_bm"));
  1101 + sin.setClzbh(arg0.getString("cl_zbh"));
  1102 + sin.setSgh(arg0.getString("s_gh"));
  1103 + sin.setsName(arg0.getString("s_name"));
  1104 + return sin;
  1105 + }
  1106 + });
  1107 +
  1108 + for (int i = 0; i < list.size(); i++) {
  1109 + Singledata sin=list.get(i);
  1110 + String jsy=sin.getSgh();
  1111 + String line=sin.getxL();
  1112 + String clzbh=sin.getClzbh();
  1113 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  1114 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  1115 +
  1116 + for (int j = 0; j < listReal.size(); j++) {
  1117 + ScheduleRealInfo s=listReal.get(j);
  1118 + if(s.getsGh().equals(jsy) && s.getClZbh().equals(clzbh)
  1119 + &&s.getXlBm().equals(line)){
  1120 + newList.add(s);
  1121 + Set<ChildTaskPlan> cts = s.getcTasks();
  1122 + if(cts != null && cts.size() > 0){
  1123 + newList_.add(s);
  1124 + }else{
  1125 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  1126 + newList_.add(s);
  1127 + }
  1128 + }
  1129 + }
  1130 + }
  1131 + double jhgl=culateMileageService.culateJhgl(newList);
  1132 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  1133 + double yygl=culateMileageService.culateSjgl(newList_);
  1134 + double ljgl=culateMileageService.culateLjgl(newList_);
  1135 + double ksgl=culateMileageService.culateKsgl(newList_);
  1136 + double jcgl=culateMileageService.culateJccgl(newList_);
  1137 +
  1138 + double zyygl=Arith.add(yygl, ljgl);
  1139 + double zksgl=Arith.add(ksgl, jcgl);
  1140 +
  1141 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  1142 +
  1143 + sin.setEmptMileage(String.valueOf(zksgl));
  1144 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  1145 + sin.setxL(BasicData.lineCode2NameMap.get(line));
  1146 + sin.setClzbh(clzbh);
  1147 + sin.setJsy("");
  1148 + sin.setjName("");
  1149 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  1150 + sin.setHyl("");
  1151 + sin.setJzl("");
  1152 + sin.setUnyyyl("");
  1153 + }
  1154 + Collections.sort(list,new SingledataByXlbm());
  1155 + }
  1156 +
  1157 + return list;
  1158 +
  1159 + }*/
  1160 +
  1161 + // 路单数据
632 1162 @Override
633 1163 public List<Singledata> singledatanew(Map<String, Object> map) {
634 1164  
... ... @@ -787,27 +1317,25 @@ public class FormsServiceImpl implements FormsService {
787 1317 List<Ylb> listYlb= ylbRepository.obtainYl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
788 1318 for (int i = 0; i < listYlb.size(); i++) {
789 1319 Ylb y=listYlb.get(i);
790   - String jsy=y.getJsy();
791   - String line=y.getXlbm();
792   - String clzbh=y.getNbbm();
793   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
794   - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
795   - for (int j = 0; j < listReal.size(); j++) {
796   - ScheduleRealInfo s=listReal.get(j);
797   - if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
798   - &&s.getXlBm().equals(line)){
799   - if(y.getLp()==null){
800   - newList.add(s);
801   - Set<ChildTaskPlan> cts = s.getcTasks();
802   - if(cts != null && cts.size() > 0){
803   - newList_.add(s);
804   - }else{
805   - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
806   - newList_.add(s);
807   - }
808   - }
809   - }else{
810   - if(y.getLp().equals(s.getLpName())){
  1320 + boolean fage=false;
  1321 + if(xlbm.equals("")){
  1322 + fage=true;
  1323 + }else{
  1324 + if(xlbm.equals(y.getXlbm())){
  1325 + fage=true;
  1326 + }
  1327 + }
  1328 + if(fage){
  1329 + String jsy=y.getJsy();
  1330 + String line=y.getXlbm();
  1331 + String clzbh=y.getNbbm();
  1332 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  1333 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  1334 + for (int j = 0; j < listReal.size(); j++) {
  1335 + ScheduleRealInfo s=listReal.get(j);
  1336 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
  1337 + &&s.getXlBm().equals(line)){
  1338 + if(y.getLp()==null){
811 1339 newList.add(s);
812 1340 Set<ChildTaskPlan> cts = s.getcTasks();
813 1341 if(cts != null && cts.size() > 0){
... ... @@ -817,65 +1345,75 @@ public class FormsServiceImpl implements FormsService {
817 1345 newList_.add(s);
818 1346 }
819 1347 }
  1348 + }else{
  1349 + if(y.getLp().equals(s.getLpName())){
  1350 + newList.add(s);
  1351 + Set<ChildTaskPlan> cts = s.getcTasks();
  1352 + if(cts != null && cts.size() > 0){
  1353 + newList_.add(s);
  1354 + }else{
  1355 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  1356 + newList_.add(s);
  1357 + }
  1358 + }
  1359 + }
820 1360 }
821 1361 }
822 1362 }
  1363 + double jhgl=culateMileageService.culateJhgl(newList);
  1364 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  1365 + double yygl=culateMileageService.culateSjgl(newList_);
  1366 + double ljgl=culateMileageService.culateLjgl(newList_);
  1367 + double ksgl=culateMileageService.culateKsgl(newList_);
  1368 + double jcgl=culateMileageService.culateJccgl(newList_);
  1369 +
  1370 + double zyygl=Arith.add(yygl, ljgl);
  1371 + double zksgl=Arith.add(ksgl, jcgl);
  1372 +
  1373 + Singledata sin=new Singledata();
  1374 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  1375 +
  1376 + sin.setEmptMileage(String.valueOf(zksgl));
  1377 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  1378 + sin.setxL(y.getXlbm());
  1379 + sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
  1380 + sin.setClzbh(clzbh);
  1381 + sin.setJsy(jsy);
  1382 + sin.setrQ(startDate);
  1383 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1384 + sin.setSgh("");
  1385 + sin.setsName("");
  1386 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  1387 + sin.setHyl(df.format(y.getYh()));
  1388 + sin.setJzl(df.format(y.getJzl()));
  1389 + sin.setUnyyyl(df.format(y.getSh()));
  1390 + listY.add(sin);
823 1391 }
824   - double jhgl=culateMileageService.culateJhgl(newList);
825   - double jhjcc=culateMileageService.culateJhJccgl(newList);
826   - double yygl=culateMileageService.culateSjgl(newList_);
827   - double ljgl=culateMileageService.culateLjgl(newList_);
828   - double ksgl=culateMileageService.culateKsgl(newList_);
829   - double jcgl=culateMileageService.culateJccgl(newList_);
830 1392  
831   - double zyygl=Arith.add(yygl, ljgl);
832   - double zksgl=Arith.add(ksgl, jcgl);
833   -
834   - Singledata sin=new Singledata();
835   - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
836   -
837   - sin.setEmptMileage(String.valueOf(zksgl));
838   - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
839   - sin.setxL(y.getXlbm());
840   - sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
841   - sin.setClzbh(clzbh);
842   - sin.setJsy(jsy);
843   - sin.setrQ(startDate);
844   - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
845   - sin.setSgh("");
846   - sin.setsName("");
847   - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
848   - sin.setHyl(df.format(y.getYh()));
849   - sin.setJzl(df.format(y.getJzl()));
850   - sin.setUnyyyl(df.format(y.getSh()));
851   - listY.add(sin);
852 1393 }
853 1394  
854 1395 List<Dlb> listDlb= dlbRepository.obtainDl(startDate, gsdm, fgsdm, xlbm, "", "xlbm");
855 1396 for (int i = 0; i < listDlb.size(); i++) {
856   -
857 1397 Dlb y=listDlb.get(i);
858   - String jsy=y.getJsy();
859   - String line=y.getXlbm();
860   - String clzbh=y.getNbbm();
861   - List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
862   - List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
863   - for (int j = 0; j < listReal.size(); j++) {
864   - ScheduleRealInfo s=listReal.get(j);
865   - if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
866   - &&s.getXlBm().equals(line)){
867   - if(y.getLp()==null){
868   - newList.add(s);
869   - Set<ChildTaskPlan> cts = s.getcTasks();
870   - if(cts != null && cts.size() > 0){
871   - newList_.add(s);
872   - }else{
873   - if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
874   - newList_.add(s);
875   - }
876   - }
877   - }else{
878   - if(y.getLp().equals(s.getLpName())){
  1398 + boolean fage=false;
  1399 + if(xlbm.equals("")){
  1400 + fage=true;
  1401 + }else{
  1402 + if(xlbm.equals(y.getXlbm())){
  1403 + fage=true;
  1404 + }
  1405 + }
  1406 + if(fage){
  1407 + String jsy=y.getJsy();
  1408 + String line=y.getXlbm();
  1409 + String clzbh=y.getNbbm();
  1410 + List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
  1411 + List<ScheduleRealInfo> newList_=new ArrayList<ScheduleRealInfo>();
  1412 + for (int j = 0; j < listReal.size(); j++) {
  1413 + ScheduleRealInfo s=listReal.get(j);
  1414 + if(s.getjGh().equals(jsy) && s.getClZbh().equals(clzbh)
  1415 + &&s.getXlBm().equals(line)){
  1416 + if(y.getLp()==null){
879 1417 newList.add(s);
880 1418 Set<ChildTaskPlan> cts = s.getcTasks();
881 1419 if(cts != null && cts.size() > 0){
... ... @@ -885,38 +1423,50 @@ public class FormsServiceImpl implements FormsService {
885 1423 newList_.add(s);
886 1424 }
887 1425 }
  1426 + }else{
  1427 + if(y.getLp().equals(s.getLpName())){
  1428 + newList.add(s);
  1429 + Set<ChildTaskPlan> cts = s.getcTasks();
  1430 + if(cts != null && cts.size() > 0){
  1431 + newList_.add(s);
  1432 + }else{
  1433 + if(s.getZdsjActual()!=null && s.getFcsjActual()!=null){
  1434 + newList_.add(s);
  1435 + }
  1436 + }
  1437 + }
888 1438 }
889 1439 }
890 1440 }
  1441 + double jhgl=culateMileageService.culateJhgl(newList);
  1442 + double jhjcc=culateMileageService.culateJhJccgl(newList);
  1443 + double yygl=culateMileageService.culateSjgl(newList_);
  1444 + double ljgl=culateMileageService.culateLjgl(newList_);
  1445 + double ksgl=culateMileageService.culateKsgl(newList_);
  1446 + double jcgl=culateMileageService.culateJccgl(newList_);
  1447 +
  1448 + double zyygl=Arith.add(yygl, ljgl);
  1449 + double zksgl=Arith.add(ksgl, jcgl);
  1450 +
  1451 + Singledata sin=new Singledata();
  1452 + sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
  1453 +
  1454 + sin.setEmptMileage(String.valueOf(zksgl));
  1455 + sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
  1456 + sin.setxL(y.getXlbm());
  1457 + sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
  1458 + sin.setClzbh(clzbh);
  1459 + sin.setJsy(jsy);
  1460 + sin.setrQ(startDate);
  1461 + sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
  1462 + sin.setSgh("");
  1463 + sin.setsName("");
  1464 + sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
  1465 + sin.setHyl(df.format(y.getHd()));
  1466 + sin.setJzl(df.format(y.getCdl()));
  1467 + sin.setUnyyyl(df.format(y.getSh()));
  1468 + listD.add(sin);
891 1469 }
892   - double jhgl=culateMileageService.culateJhgl(newList);
893   - double jhjcc=culateMileageService.culateJhJccgl(newList);
894   - double yygl=culateMileageService.culateSjgl(newList_);
895   - double ljgl=culateMileageService.culateLjgl(newList_);
896   - double ksgl=culateMileageService.culateKsgl(newList_);
897   - double jcgl=culateMileageService.culateJccgl(newList_);
898   -
899   - double zyygl=Arith.add(yygl, ljgl);
900   - double zksgl=Arith.add(ksgl, jcgl);
901   -
902   - Singledata sin=new Singledata();
903   - sin.setJhlc(String.valueOf(Arith.add(zyygl,zksgl)));
904   -
905   - sin.setEmptMileage(String.valueOf(zksgl));
906   - sin.setJhjl(String.valueOf(Arith.add(jhgl,jhjcc)));
907   - sin.setxL(y.getXlbm());
908   - sin.setXlmc(BasicData.lineCode2NameMap.get(y.getXlbm()));
909   - sin.setClzbh(clzbh);
910   - sin.setJsy(jsy);
911   - sin.setrQ(startDate);
912   - sin.setjName(BasicData.allPerson.get(gsdm+"-"+jsy));
913   - sin.setSgh("");
914   - sin.setsName("");
915   - sin.setgS(BasicData.businessFgsCodeNameMap.get(fgsdm+"_"+gsdm));
916   - sin.setHyl(df.format(y.getHd()));
917   - sin.setJzl(df.format(y.getCdl()));
918   - sin.setUnyyyl(df.format(y.getSh()));
919   - listD.add(sin);
920 1470 }
921 1471  
922 1472 Collections.sort(listY,new SingledataByXlbm());
... ...
src/main/java/com/bsth/service/geo_data/GeoDataService.java 0 → 100644
  1 +package com.bsth.service.geo_data;
  2 +
  3 +import com.bsth.entity.geo_data.GeoStation;
  4 +
  5 +import java.util.Map;
  6 +
  7 +/**
  8 + * Created by panzhao on 2017/12/7.
  9 + */
  10 +public interface GeoDataService {
  11 +
  12 +
  13 + Map<String, Object> findGeoStations(String lineCode);
  14 +
  15 +
  16 + Map<String, Object> findGeoRoad(String lineCode);
  17 +
  18 + Map<String, Object> updateBufferInfo(GeoStation station);
  19 +
  20 + Map<String, Object> updateStationName(Map<String, Object> map);
  21 +}
... ...
src/main/java/com/bsth/service/geo_data/impl/GeoDataServiceImpl.java 0 → 100644
  1 +package com.bsth.service.geo_data.impl;
  2 +
  3 +import com.bsth.common.ResponseCode;
  4 +import com.bsth.entity.geo_data.GeoRoad;
  5 +import com.bsth.entity.geo_data.GeoStation;
  6 +import com.bsth.service.geo_data.GeoDataService;
  7 +import com.bsth.util.TransGPS;
  8 +import com.google.common.base.Splitter;
  9 +import org.slf4j.Logger;
  10 +import org.slf4j.LoggerFactory;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.jdbc.core.BeanPropertyRowMapper;
  13 +import org.springframework.jdbc.core.JdbcTemplate;
  14 +import org.springframework.jdbc.datasource.DataSourceTransactionManager;
  15 +import org.springframework.stereotype.Service;
  16 +import org.springframework.transaction.TransactionDefinition;
  17 +import org.springframework.transaction.TransactionStatus;
  18 +import org.springframework.transaction.support.DefaultTransactionDefinition;
  19 +
  20 +import java.util.ArrayList;
  21 +import java.util.HashMap;
  22 +import java.util.List;
  23 +import java.util.Map;
  24 +
  25 +/**
  26 + * Created by panzhao on 2017/12/8.
  27 + */
  28 +@Service
  29 +public class GeoDataServiceImpl implements GeoDataService {
  30 +
  31 + @Autowired
  32 + JdbcTemplate jdbcTemplate;
  33 +
  34 + Logger logger = LoggerFactory.getLogger(this.getClass());
  35 +
  36 + @Override
  37 + public Map<String, Object> findGeoStations(String lineCode) {
  38 +
  39 + Map<String, Object> map = new HashMap();
  40 + try {
  41 + 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";
  42 +
  43 +
  44 + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class));
  45 +
  46 + for (GeoStation station : list) {
  47 + if (station.getShapesType().equals("d"))
  48 + station.setBdCoords(multiWgsToBd(station.getgPolygonGrid(), 9, 3));
  49 + }
  50 + map.put("status", ResponseCode.SUCCESS);
  51 + map.put("list", list);
  52 + } catch (Exception e) {
  53 + logger.error("", e);
  54 + map.put("status", ResponseCode.ERROR);
  55 + map.put("msg", "服务器出现异常");
  56 + }
  57 + return map;
  58 + }
  59 +
  60 + @Override
  61 + public Map<String, Object> findGeoRoad(String lineCode) {
  62 + Map<String, Object> map = new HashMap();
  63 + try {
  64 + 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";
  65 +
  66 +
  67 + List<GeoRoad> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoRoad.class));
  68 +
  69 + for (GeoRoad road : list) {
  70 + road.setBdCoords(multiWgsToBd(road.getGsectionVector(), 11, 2));
  71 + }
  72 + map.put("status", ResponseCode.SUCCESS);
  73 + map.put("list", list);
  74 + } catch (Exception e) {
  75 + logger.error("", e);
  76 + map.put("status", ResponseCode.ERROR);
  77 + map.put("msg", "服务器出现异常");
  78 + }
  79 + return map;
  80 + }
  81 +
  82 + /**
  83 + * 编辑缓冲区信息
  84 + *
  85 + * @param station
  86 + * @return
  87 + */
  88 + @Override
  89 + public Map<String, Object> updateBufferInfo(GeoStation station) {
  90 + Map<String, Object> rs = new HashMap<>();
  91 + try {
  92 + //坐标转换
  93 + TransGPS.Location loc = TransGPS.LocationMake(station.getgLonx(), station.getgLaty());
  94 + loc = TransGPS.bd_decrypt(loc);
  95 + loc = TransGPS.transformFromGCJToWGS(loc);
  96 + station.setgLaty(Float.parseFloat(String.valueOf(loc.getLat())));
  97 + station.setgLonx(Float.parseFloat(String.valueOf(loc.getLng())));
  98 +
  99 + String sql;
  100 + String shapesType = station.getShapesType();
  101 + int rsCount = -1;
  102 + if (shapesType.equals("r")) {
  103 + sql = "update bsth_c_station set g_lonx=?, g_laty=?, radius=?,shapes_type='r' where station_cod=?";
  104 + rsCount = jdbcTemplate.update(sql, station.getgLonx(), station.getgLaty(), station.getRadius(), station.getStationCode());
  105 + } else if (shapesType.equals("d")) {
  106 + //多边形坐标转换
  107 + String bdPolygon = "POLYGON((" + station.getgPolygonGrid() + "))";
  108 + String wgsPolygon = "POLYGON((" + bdPolygon2Wgs(station.getgPolygonGrid()) + "))";
  109 + sql = "update bsth_c_station set g_lonx=?, g_laty=?,shapes_type='d', radius=null,b_polygon_grid=ST_GeomFromText('" + bdPolygon + "'),g_polygon_grid=ST_GeomFromText('" + wgsPolygon + "') where station_cod=?";
  110 +
  111 + rsCount = jdbcTemplate.update(sql, station.getgLonx(), station.getgLaty(), station.getStationCode());
  112 + }
  113 +
  114 + //从数据库里重新查询对象
  115 + if (rsCount > 0) {
  116 + rs.put("station", findOne(station.getId()));
  117 + rs.put("status", ResponseCode.SUCCESS);
  118 + }
  119 +
  120 + } catch (Exception e) {
  121 + logger.error("", e);
  122 + rs.put("status", ResponseCode.ERROR);
  123 + rs.put("msg", "服务器出现异常");
  124 + }
  125 + return rs;
  126 + }
  127 +
  128 + /**
  129 + * 修改站点路由和站点名称
  130 + *
  131 + * @param map
  132 + * @return
  133 + */
  134 + @Override
  135 + public Map<String, Object> updateStationName(Map<String, Object> map) {
  136 + Map<String, Object> rs = new HashMap<>();
  137 +
  138 + //编程式事务
  139 + DataSourceTransactionManager tran = new DataSourceTransactionManager(jdbcTemplate.getDataSource());
  140 + DefaultTransactionDefinition def = new DefaultTransactionDefinition();
  141 + def.setPropagationBehavior(TransactionDefinition.PROPAGATION_REQUIRED);
  142 + TransactionStatus status = tran.getTransaction(def);
  143 + try {
  144 +
  145 + int id = Integer.parseInt(map.get("id").toString());
  146 + String name = map.get("stationName").toString();
  147 + String code = map.get("stationCode").toString();
  148 + //String lineCode = map.get("lineCode").toString();
  149 + //String stationMark = map.get("stationMark").toString();
  150 +
  151 + //更新历史站点路由
  152 + jdbcTemplate.update("update bsth_c_ls_stationroute set station_name=? where id=?", name, id);
  153 + //更新站点
  154 + jdbcTemplate.update("update bsth_c_station set station_name=? where station_cod=?", name, code);
  155 +
  156 + tran.commit(status);
  157 +
  158 + rs.put("station", findOne(id));
  159 + rs.put("status", ResponseCode.SUCCESS);
  160 + } catch (Exception e) {
  161 + tran.rollback(status);
  162 + logger.error("", e);
  163 + rs.put("status", ResponseCode.ERROR);
  164 + rs.put("msg", "服务器出现异常");
  165 + }
  166 + return rs;
  167 + }
  168 +
  169 +
  170 + /**
  171 + * 根据路由ID 获取站点
  172 + *
  173 + * @param id
  174 + * @return
  175 + */
  176 + private GeoStation findOne(int id) {
  177 + 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 id=" + id + " AND destroy = 0) t1 LEFT JOIN bsth_c_station t2 ON t1.station_code = t2.station_cod";
  178 + List<GeoStation> list = jdbcTemplate.query(sql, BeanPropertyRowMapper.newInstance(GeoStation.class));
  179 +
  180 + GeoStation s = list.get(0);
  181 + if (s.getShapesType().equals("d"))
  182 + s.setBdCoords(multiWgsToBd(s.getgPolygonGrid(), 9, 3));
  183 +
  184 + return s;
  185 + }
  186 +
  187 + private String bdPolygon2Wgs(String bdPolygon) {
  188 + StringBuilder wgsPolygon = new StringBuilder();
  189 + List<String> list = Splitter.on(",").splitToList(bdPolygon);
  190 + String[] array;
  191 +
  192 + TransGPS.Location location;
  193 + for (String p : list) {
  194 + array = p.split(" ");
  195 + location = TransGPS.transformFromGCJToWGS(TransGPS.bd_decrypt(TransGPS.LocationMake(Double.parseDouble(array[0]), Double.parseDouble(array[1]))));
  196 +
  197 + wgsPolygon.append(location.getLng() + " " + location.getLat() + ",");
  198 + }
  199 +
  200 + if (wgsPolygon.length() > 0) {
  201 + wgsPolygon.deleteCharAt(wgsPolygon.length() - 1);
  202 + }
  203 + return wgsPolygon.toString();
  204 + }
  205 +
  206 + /**
  207 + * wgs 坐标数组转 百度
  208 + *
  209 + * @return
  210 + */
  211 + private List<String> multiWgsToBd(String crdStr, int si, int ei) {
  212 + List<String> bdList = new ArrayList<>();
  213 +
  214 + List<String> gList = Splitter.on(",").splitToList(crdStr.substring(si, crdStr.length() - ei));
  215 + TransGPS.Location location;
  216 + String[] cds;
  217 + for (String gs : gList) {
  218 + cds = gs.split(" ");
  219 + location = TransGPS.bd_encrypt(TransGPS.transformFromWGSToGCJ(TransGPS.LocationMake(Double.parseDouble(cds[0]), Double.parseDouble(cds[1]))));
  220 +
  221 + bdList.add(location.getLng() + " " + location.getLat());
  222 + }
  223 + return bdList;
  224 + }
  225 +
  226 +}
0 227 \ No newline at end of file
... ...
src/main/java/com/bsth/service/impl/LineVersionsServiceImpl.java
... ... @@ -250,5 +250,24 @@ public class LineVersionsServiceImpl extends BaseServiceImpl&lt;LineVersions, Integ
250 250 }
251 251 return resultMap;
252 252 }
253   -
  253 +
  254 + /**
  255 + * 获取当前线路版本号
  256 + */
  257 + @Override
  258 + public Integer findCurrentVersion(int lineId) {
  259 + return repository.findCurrentVersion(lineId);
  260 + }
  261 +
  262 + @Override
  263 + public Map<String, Object> issueVersion(int id) {
  264 + Map<String, Object> resultMap = new HashMap<>();
  265 +
  266 + int statu = repository.issueVersion(id);
  267 + if (statu == 1)
  268 + resultMap.put("status", ResponseCode.SUCCESS);
  269 + else
  270 + resultMap.put("status", ResponseCode.ERROR);
  271 + return resultMap;
  272 + }
254 273 }
... ...
src/main/java/com/bsth/service/impl/SectionRouteServiceImpl.java
... ... @@ -131,8 +131,8 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
131 131 @Transactional
132 132 @Override
133 133 public List<Map<String, Object>> getSectionRouteCache(Map<String, Object> map) {
134   - int lineId = map.get("line.id_eq").equals("") ? 0 : Integer.parseInt(map.get("line.id_eq").toString());
135   - int directions = map.get("directions_eq").equals("") ? 0 : Integer.parseInt(map.get("directions_eq").toString());
  134 + int lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
  135 + int directions = map.get("dir").equals("") ? 0 : Integer.parseInt(map.get("dir").toString());
136 136 List<Object[]> listObjArray = Cacherepository.getSectionRouteCache(lineId, directions);
137 137 List<Map<String, Object>> resultList = new ArrayList<Map<String,Object>>();
138 138 if(listObjArray.size()>0) {
... ... @@ -297,6 +297,23 @@ public class SectionRouteServiceImpl extends BaseServiceImpl&lt;SectionRoute, Integ
297 297 }
298 298 return list;
299 299 }
  300 +
  301 + @Override
  302 + public List<Map<String, Object>> findCacheUpSectionRouteCode(Map<String, Object> map) {
  303 + Integer lineId = map.get("lineId").equals("") ? null : Integer.parseInt(map.get("lineId").toString());
  304 + Integer direction = map.get("direction").equals("") ? null : Integer.parseInt(map.get("direction").toString());
  305 + Integer stationRouteCode = map.get("sectionRouteCode").equals("") ? null : Integer.parseInt(map.get("sectionRouteCode").toString());
  306 + List<Object[]> reslutList = Cacherepository.findCacheUpSectionRouteCode(lineId, direction, stationRouteCode);
  307 + List<Map<String, Object>> list = new ArrayList<Map<String,Object>>();
  308 + if(reslutList.get(0)!=null) {
  309 + for(int i = 0 ; i <reslutList.size() ;i++){
  310 + Map<String, Object> tempM = new HashMap<String, Object>();
  311 + tempM.put("sectionrouteCode", reslutList.get(i));
  312 + list.add(tempM);
  313 + }
  314 + }
  315 + return list;
  316 + }
300 317  
301 318 @Override
302 319 public Map<String, Object> quoteSection(Map<String, Object> map) {
... ...
src/main/java/com/bsth/service/impl/SectionServiceImpl.java
... ... @@ -7,9 +7,7 @@ import java.util.HashMap;
7 7 import java.util.List;
8 8 import java.util.Map;
9 9  
10   -import org.mozilla.javascript.ObjArray;
11 10 import org.springframework.beans.factory.annotation.Autowired;
12   -import org.springframework.data.jpa.domain.Specification;
13 11 import org.springframework.stereotype.Service;
14 12 import org.springframework.transaction.annotation.Transactional;
15 13  
... ... @@ -17,7 +15,6 @@ import com.alibaba.fastjson.JSONArray;
17 15 import com.alibaba.fastjson.JSONObject;
18 16 import com.bsth.common.ResponseCode;
19 17 import com.bsth.entity.Line;
20   -import com.bsth.entity.LineVersions;
21 18 import com.bsth.entity.LsSectionRoute;
22 19 import com.bsth.entity.LsStationRoute;
23 20 import com.bsth.entity.Section;
... ... @@ -40,7 +37,6 @@ import com.bsth.util.TransGPS;
40 37 import com.bsth.util.TransGPS.Location;
41 38 import com.bsth.util.Geo.GeoUtils;
42 39 import com.bsth.util.Geo.Point;
43   -import com.google.gson.JsonObject;
44 40  
45 41 /**
46 42 *
... ... @@ -171,7 +167,7 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
171 167 String bsectionVectorS = null;
172 168 if(!sectionsBpoints.equals(""))
173 169 bsectionVectorS = "LINESTRING(" + sectionsBpoints + ")";
174   - repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, versions, sectionId);
  170 + repository.systemSave(sectionCode, sectionName, crosesRoad, endNode, startNode, middleNode, gsectionVector, bsectionVectorS, sectionType, csectionVector, roadCoding, sectionDistance, sectionTime, dbType, speedLimit, descriptions, 1, sectionId);
175 171 SectionRoute route = new SectionRoute();
176 172 Line line = lineRepository.findOne(sectionRouteLine);
177 173 Section section = repository.findOne(sectionId);
... ... @@ -663,7 +659,8 @@ public class SectionServiceImpl extends BaseServiceImpl&lt;Section, Integer&gt; implem
663 659 // 路段时长
664 660 Double sectionTime = map.get("sectionTime").equals("") ? null : Double.valueOf(map.get("sectionTime").toString());
665 661 // 路段路由
666   - Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
  662 +// Integer sectionrouteCode = map.get("sectionrouteCode").equals("") ? null : Integer.valueOf(map.get("sectionrouteCode").toString());
  663 + Integer sectionrouteCode = 100;
667 664 SectionRouteCache resultS = routeCacheRepository.findOne(sectionRouteId);
668 665 int old_code = resultS.getSectionrouteCode();
669 666 if(sectionrouteCode!=null) {
... ...
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
... ... @@ -1172,7 +1172,7 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
1172 1172  
1173 1173 tempM.put("stationCode", objects.get(i)[19]);
1174 1174  
1175   - tempM.put("stationName", objects.get(i)[20]);
  1175 + tempM.put("stationRouteName", objects.get(i)[20]);
1176 1176  
1177 1177 tempM.put("stationRoadCoding", objects.get(i)[21]);
1178 1178  
... ...
src/main/java/com/bsth/service/impl/StationServiceImpl.java
... ... @@ -26,6 +26,7 @@ import com.bsth.entity.StationRoute;
26 26 import com.bsth.entity.StationRouteCache;
27 27 import com.bsth.repository.LineInformationRepository;
28 28 import com.bsth.repository.LineRepository;
  29 +import com.bsth.repository.LineVersionsRepository;
29 30 import com.bsth.repository.SectionRepository;
30 31 import com.bsth.repository.SectionRouteCacheRepository;
31 32 import com.bsth.repository.SectionRouteRepository;
... ... @@ -83,8 +84,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
83 84 @Autowired
84 85 private SectionRouteCacheRepository sectionRouteCacheRepository;
85 86  
86   - private GeoUtils geoUtils;
87   -
  87 + @Autowired
  88 + LineVersionsRepository lineVersionsRepository;
  89 +
88 90 Logger logger = LoggerFactory.getLogger(this.getClass());
89 91  
90 92 /**
... ... @@ -293,20 +295,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
293 295 Integer stationId = Integer.parseInt(isHaveMap.get("id").toString());
294 296 arg0 = repository.findOne(stationId);
295 297  
296   - if ((i==0 || i==stationsArray.size()-1) && resultLine.getLinePlayType() != 1) {// (起终点站)
297   - List<Station> list = new ArrayList<>();
298   - list.add(arg0);
299   - List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
300   - Station station = stationlist.get(0);
301   - // 站点编码
302   - long stationCode = GetUIDAndCode.getStationId();
303   - station.setStationCod(String.valueOf(stationCode));
304   - station.setId((int)stationCode);
305   - station.setCreateDate(null);
306   - station.setUpdateDate(null);
307   - repository.save(station);
308   - arg0 = station;
309   - } else if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  298 + if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  299 + arg0 = loopStartStation;
  300 + } else {
310 301 List<Station> list = new ArrayList<>();
311 302 list.add(arg0);
312 303 List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
... ... @@ -318,12 +309,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
318 309 station.setCreateDate(null);
319 310 station.setUpdateDate(null);
320 311 repository.save(station);
321   - arg0 = station;
322   - loopStartStation = arg0;
323   - repository.save(arg0);
324   - } else if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
325   - arg0 = loopStartStation;
326   - }
  312 + arg0 = station;
  313 + if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  314 + loopStartStation = arg0;
  315 + }
  316 + }
327 317 }else {
328 318 // 站点编码
329 319 long stationCode = GetUIDAndCode.getStationId();
... ... @@ -417,8 +407,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
417 407 // 中途站
418 408 route.setStationMark("Z");
419 409 }
420   - // 版本号
421   - route.setVersions(versions);
  410 + // 版本号(获取线路当前版本)
  411 + Integer version = lineVersionsRepository.findCurrentVersion(resultLine.getId());
  412 + route.setVersions(version);
422 413 // 站点ID
423 414 route.setStation(arg0);
424 415 // 方向
... ... @@ -782,6 +773,153 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
782 773 Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
783 774 // 说明
784 775 String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
  776 + // 站点编码
  777 + stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
  778 + // 站点ID
  779 + stationId = Integer.valueOf(stationCod);
  780 + // 圆半径
  781 + Integer radius = map.get("radius").equals("") ? null : Integer.parseInt(map.get("radius").toString());
  782 + // 图形类型
  783 + String shapesType = map.get("shapesType").equals("") ? "" : map.get("shapesType").toString();
  784 + // 创建人
  785 + Integer createBy = map.get("createBy").equals("") ? null : Integer.parseInt(map.get("createBy").toString());
  786 + // 修改人
  787 + Integer updateBy = map.get("updateBy").equals("") ? null : Integer.parseInt(map.get("updateBy").toString());
  788 + // 城建坐标经度
  789 + Float x = map.get("x").equals("") ? null : Float.parseFloat(map.get("x").toString());
  790 + // 城建坐标纬度
  791 + Float y = map.get("y").equals("") ? null : Float.parseFloat(map.get("y").toString());
  792 + // 道路编码
  793 + String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
  794 + // 原坐标类型
  795 + String dbType = map.get("dbType").equals("") ? "" : map.get("dbType").toString();
  796 + // WGS经纬度
  797 + Float gLonx = null;
  798 + // WGS纬度
  799 + Float gLaty = null;
  800 + if(bJwpointsArray.length>0) {
  801 + Location resultPoint = FromBDPointToWGSPoint(bJwpointsArray[0],bJwpointsArray[1]);
  802 + gLonx = (float)resultPoint.getLng();
  803 + gLaty = (float)resultPoint.getLat();
  804 + }
  805 + // 多边形原坐标点集合
  806 + String bPloygonGrid = map.get("bPolygonGrid").equals("") ? "" : map.get("bPolygonGrid").toString();
  807 + // 多边形WGS坐标点集合
  808 + String gPloygonGrid ="";
  809 + if(!bPloygonGrid.equals("")) {
  810 + String bPloygonGridArray[] = bPloygonGrid.split(",");
  811 + int bLen_ = bPloygonGridArray.length;
  812 + for(int b = 0 ;b<bLen_;b++) {
  813 + String tempArray[]= bPloygonGridArray[b].split(" ");
  814 + Location resultPoint = FromBDPointToWGSPoint(tempArray[0],tempArray[1]);
  815 + if(b==0) {
  816 + gPloygonGrid = String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
  817 + }else {
  818 + gPloygonGrid = gPloygonGrid + ',' + String.valueOf(resultPoint.getLng()) + " " + String.valueOf(resultPoint.getLat());
  819 + }
  820 + }
  821 + }
  822 + if(bPloygonGrid.equals(""))
  823 + bPloygonGrid = null;
  824 + else
  825 + bPloygonGrid = "POLYGON((" + bPloygonGrid +"))";
  826 + if(gPloygonGrid.equals(""))
  827 + gPloygonGrid = null;
  828 + else
  829 + gPloygonGrid = "POLYGON((" + gPloygonGrid +"))";
  830 + // 保存站点
  831 + repository.stationSave(stationCod, zdmc, roadCoding, dbType, bJwpoints,
  832 + gLonx, gLaty, x, y, gPloygonGrid,bPloygonGrid, destroy, radius,
  833 + shapesType, versions, descriptions, createBy, updateBy,stationId);
  834 +
  835 + Station station = repository.findOne(stationId);
  836 + StationRoute arg0 = new StationRoute();
  837 + // 距离
  838 + Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString());
  839 + // 时间
  840 + Double toTime = map.get("toTime").equals("") ? 0.0d : Double.parseDouble(map.get("toTime").toString());
  841 + // 站点路由名称
  842 + String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
  843 + // 线路ID
  844 + int line = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
  845 + // 线路信息
  846 + Line resultLine = lineRepository.findOne(line);
  847 + // 站点路由序号
  848 + String stationRouteCodeStr = map.get("stationRouteCode").equals("") ? "" : map.get("stationRouteCode").toString();
  849 + // 站点类型
  850 + String stationMark = map.get("stationMark").equals("") ? "" : map.get("stationMark").toString();
  851 + Integer stationRouteCode = null;
  852 + if(stationRouteCodeStr!="") {
  853 + String stationRouteCodeArray [] = stationRouteCodeStr.split("_");
  854 + stationRouteCode = Integer.parseInt(stationRouteCodeArray[0].toString())+1;
  855 + }else {
  856 + stationRouteCode = 100;
  857 + }
  858 + // 线路
  859 + arg0.setLine(resultLine);
  860 + arg0.setLineCode(resultLine.getLineCode());
  861 + // 站点
  862 + arg0.setStation(station);
  863 + // 站点路由名称
  864 + arg0.setStationName(stationName);
  865 + // 站点路由编码
  866 + arg0.setStationCode(station.getStationCod());
  867 + // 站点路由序号
  868 + arg0.setStationRouteCode(stationRouteCode);
  869 + // 站点路由类型
  870 + arg0.setStationMark(stationMark);
  871 + // 站点路由站点方向
  872 + arg0.setDirections(directions);
  873 + // 站点路由到站距离
  874 + arg0.setDistances(distances);
  875 + // 站点路由到站时间
  876 + arg0.setToTime(toTime);
  877 + // 站点版本号
  878 + arg0.setVersions(versions);
  879 + // 是否撤销
  880 + arg0.setDestroy(destroy);
  881 + // 站点路由说明
  882 + arg0.setDescriptions(descriptions);
  883 + routeRepository.stationUpdStationRouteCode(line, directions, stationRouteCode);
  884 + routeRepository.save(arg0);
  885 + resultMap.put("status", ResponseCode.SUCCESS);
  886 + } catch (Exception e) {
  887 + resultMap.put("status", ResponseCode.ERROR);
  888 + logger.error("save erro.", e);
  889 + }
  890 + return resultMap;
  891 + }
  892 +
  893 + /**
  894 + * @Description :TODO(新增缓存站点保存)
  895 + */
  896 + @Transactional
  897 + @Override
  898 + public Map<String, Object> stationCacheSave(Map<String, Object> map) {
  899 + Map<String, Object> resultMap = new HashMap<String, Object>();
  900 + try {
  901 + // 站点编码
  902 + String stationCod = "";
  903 + // 站点ID
  904 + Integer stationId = null;
  905 + // 站点名称
  906 + String zdmc = map.get("zdmc").equals("") ? "" : map.get("zdmc").toString();
  907 + // 方向
  908 + Integer directions = map.get("directions").equals("") ? null : Integer.parseInt(map.get("directions").toString());
  909 + // 原坐标点
  910 + String bJwpoints = map.get("bJwpoints").equals("") ? "" : map.get("bJwpoints").toString();
  911 + String bJwpointsArray[] = null;
  912 + if(bJwpoints!=null) {
  913 + bJwpointsArray = bJwpoints.split(" ");
  914 + }
  915 + List<Object[]> stationNameList = repository.findStationName(directions,zdmc);
  916 + Map<String, Object> isHaveMap = isHaveStationname(bJwpointsArray[0],bJwpointsArray[1],stationNameList);
  917 + // 是否撤销
  918 + Integer destroy = map.get("destroy").equals("") ? null : Integer.parseInt(map.get("destroy").toString());
  919 + // 版本
  920 + Integer versions = map.get("versions").equals("") ? null : Integer.parseInt(map.get("versions").toString());
  921 + // 说明
  922 + String descriptions = map.get("descriptions").equals("") ? "" : map.get("descriptions").toString();
785 923 if(Boolean.parseBoolean(isHaveMap.get("isHave").toString())) {
786 924 stationId = Integer.parseInt(isHaveMap.get("id").toString());
787 925 }else {
... ... @@ -845,7 +983,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
845 983 shapesType, versions, descriptions, createBy, updateBy,stationId);
846 984 }
847 985 Station station = repository.findOne(stationId);
848   - StationRoute arg0 = new StationRoute();
  986 + StationRouteCache arg0 = new StationRouteCache();
849 987 // 距离
850 988 Double distances = map.get("distances").equals("") ? 0.0d : Double.parseDouble(map.get("distances").toString());
851 989 // 时间
... ... @@ -892,8 +1030,8 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
892 1030 arg0.setDestroy(destroy);
893 1031 // 站点路由说明
894 1032 arg0.setDescriptions(descriptions);
895   - routeRepository.stationUpdStationRouteCode(line, directions, stationRouteCode);
896   - routeRepository.save(arg0);
  1033 + routeCacheRepository.stationUpdStationRouteCode(line, directions, stationRouteCode);
  1034 + routeCacheRepository.save(arg0);
897 1035 resultMap.put("status", ResponseCode.SUCCESS);
898 1036 } catch (Exception e) {
899 1037 resultMap.put("status", ResponseCode.ERROR);
... ... @@ -926,7 +1064,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
926 1064 String stationCod = map.get("stationCod").equals("") ? "" : map.get("stationCod").toString();
927 1065 String zdmc = map.get("zdmc").equals("") ? "" : map.get("zdmc").toString();
928 1066 // 站点名称
929   - String stationName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
  1067 + String stationRouteName = map.get("stationName").equals("") ? "" : map.get("stationName").toString();
930 1068 // 所在道路编码
931 1069 String roadCoding = map.get("roadCoding").equals("") ? "" : map.get("roadCoding").toString();
932 1070 // 经纬坐标类型
... ... @@ -1013,7 +1151,7 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1013 1151 Station station = repository.findOne(stationId);
1014 1152 Line line = lineRepository.findOne(LineId);
1015 1153 StationRoute stationRoute = new StationRoute();
1016   - stationRoute.setStationName(stationName);
  1154 + stationRoute.setStationName(stationRouteName);
1017 1155 stationRoute.setId(stationRouteId);
1018 1156 stationRoute.setStationRouteCode(stationRouteCode);
1019 1157 stationRoute.setStation(station);
... ... @@ -1200,15 +1338,15 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1200 1338 sectionRoute.setLine(resultLine);
1201 1339 // 路段编码
1202 1340 sectionRoute.setSectionCode(sectionCode);
1203   - // 版本
1204   - sectionRoute.setVersions(versions);
  1341 + // 版本号(获取线路当前版本)
  1342 + Integer version = lineVersionsRepository.findCurrentVersion(resultLine.getId());
  1343 + sectionRoute.setVersions(version);
1205 1344 sectionRoute.setDestroy(destroy);
1206 1345 // 方向
1207 1346 sectionRoute.setDirections(directions);
1208 1347 // 保存路段
1209 1348 sectionRouteRepository.save(sectionRoute);
1210 1349 }
1211   -
1212 1350 }
1213 1351  
1214 1352 /**
... ... @@ -1229,10 +1367,10 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1229 1367 String libraryPointstr = s.getbJwpoints();
1230 1368 String points[] = libraryPointstr.toString().split(" ");
1231 1369 Point center = new Point(Double.parseDouble(points[0]), Double.parseDouble(points[1]));
1232   - // 在100m内认为是同一个站点
1233   - Circle circle = new Circle(center, 100);
  1370 + // 在60m内认为是同一个站点
  1371 + Circle circle = new Circle(center, 60);
1234 1372 // 匹配到了用数据库中的点替换
1235   - if (geoUtils.isPointInCircle(point, circle)) {
  1373 + if (GeoUtils.isPointInCircle(point, circle)) {
1236 1374 map.put("name", s.getStationName().toString());
1237 1375 map.put("potion_lng", points[0]);
1238 1376 map.put("potion_lat", points[1]);
... ... @@ -1372,20 +1510,9 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1372 1510 Integer stationId = Integer.parseInt(stationsArray.getJSONObject(i).get("id").toString());
1373 1511 arg0 = repository.findOne(stationId);
1374 1512  
1375   - if ((i==0 || i==stationsArray.size()-1) && resultLine.getLinePlayType() != 1) {// (起终点站)
1376   - List<Station> list = new ArrayList<>();
1377   - list.add(arg0);
1378   - List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
1379   - Station station = stationlist.get(0);
1380   - // 站点编码
1381   - long stationCode = GetUIDAndCode.getStationId();
1382   - station.setStationCod(String.valueOf(stationCode));
1383   - station.setId((int)stationCode);
1384   - station.setCreateDate(null);
1385   - station.setUpdateDate(null);
1386   - repository.save(station);
1387   - arg0 = station;
1388   - } else if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  1513 + if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  1514 + arg0 = loopStartStation;
  1515 + } else {
1389 1516 List<Station> list = new ArrayList<>();
1390 1517 list.add(arg0);
1391 1518 List<Station> stationlist = JSONArray.parseArray(JSON.toJSONString(list), Station.class);
... ... @@ -1397,12 +1524,11 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1397 1524 station.setCreateDate(null);
1398 1525 station.setUpdateDate(null);
1399 1526 repository.save(station);
1400   - arg0 = station;
1401   - loopStartStation = arg0;
1402   - repository.save(arg0);
1403   - } else if (i==stationsArray.size()-1 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
1404   - arg0 = loopStartStation;
1405   - }
  1527 + arg0 = station;
  1528 + if (i==0 && resultLine.getLinePlayType() == 1) {// 环线终点和起点引用同一个站
  1529 + loopStartStation = arg0;
  1530 + }
  1531 + }
1406 1532 }else {
1407 1533 // 站点编码
1408 1534 long stationCode = GetUIDAndCode.getStationId();
... ... @@ -1735,4 +1861,36 @@ public class StationServiceImpl extends BaseServiceImpl&lt;Station, Integer&gt; implem
1735 1861 }
1736 1862 return resultMap;
1737 1863 }
  1864 +
  1865 + /**
  1866 + * @Description :TODO(引用当前版本)
  1867 + */
  1868 + @Override
  1869 + @Transactional
  1870 + public Map<String, Object> referenceCurrentVersion(Map<String, Object> map) {
  1871 + Map<String, Object> resultMap = new HashMap<String, Object>();
  1872 + try {
  1873 + Integer lineId = Integer.parseInt(map.get("lineId").toString());
  1874 + Integer dir = Integer.parseInt(map.get("directions").toString());
  1875 + List<StationRoute> stationRoutes = routeRepository.findByLine(lineId, dir);
  1876 + List<SectionRoute> sectionRoutes = sectionRouteRepository.findByLine(lineId, dir);
  1877 + // 删除缓存路由数据
  1878 + routeCacheRepository.stationRouteCacheDel(lineId, dir);
  1879 + sectionRouteCacheRepository.sectionRouteCacheDel(lineId, dir);
  1880 + // 当前版本路由保存到缓存路由
  1881 + List<StationRouteCache> stationRouteCaches = JSONArray.parseArray(JSON.toJSONString(stationRoutes), StationRouteCache.class);
  1882 + List<SectionRouteCache> sectionRouteCaches = JSONArray.parseArray(JSON.toJSONString(sectionRoutes), SectionRouteCache.class);
  1883 + for(StationRouteCache sr:stationRouteCaches) {
  1884 + routeCacheRepository.save(sr);
  1885 + }
  1886 + for(SectionRouteCache sr:sectionRouteCaches) {
  1887 + sectionRouteCacheRepository.save(sr);
  1888 + }
  1889 + resultMap.put("status", ResponseCode.SUCCESS);
  1890 + } catch (Exception e) {
  1891 + resultMap.put("status", ResponseCode.ERROR);
  1892 + logger.error("save erro.", e);
  1893 + }
  1894 + return resultMap;
  1895 + }
1738 1896 }
1739 1897 \ No newline at end of file
... ...
src/main/java/com/bsth/service/impl/TrafficManageServiceImpl.java
... ... @@ -200,13 +200,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
200 200  
201 201 // 先查上行
202 202 upStationsList = stationRouteRepository.findByLine(line.getLineCode(), 0);
  203 + Map<String, Integer> stationNumMap = getStationName2YgcNumberMap(line.getLineCode());
203 204 int startId = 1;
204   - startId = packagStationXml(upStationsList, sBuffer, startId);
  205 + startId = packagStationXml(upStationsList, sBuffer, startId,stationNumMap);
205 206 // 环线不查下行
206 207 if(line.getLinePlayType() != 1){
207 208 // 再查下行
208 209 downStationsList = stationRouteRepository.findByLine(line.getLineCode(), 1);
209   - packagStationXml(downStationsList, sBuffer, startId);
  210 + packagStationXml(downStationsList, sBuffer, startId,stationNumMap);
210 211 }
211 212 sBuffer.append("</StationList>");
212 213  
... ... @@ -223,6 +224,10 @@ public class TrafficManageServiceImpl implements TrafficManageService{
223 224 sBuffer.append("</LinePointList>");
224 225 sBuffer.append("</XL>");
225 226 sBuffer.append("</XLs>");
  227 + // 临时添加,后面删除
  228 + if(sBuffer.indexOf("<ZDXH>0</ZDXH>") != -1){
  229 + return "0";
  230 + }
226 231 // 调用上传方法
227 232 if(getWebServiceSoapUp().setXL(userNameUp,passwordUp,sBuffer.toString()).isSuccess()){
228 233 result = "success";
... ... @@ -240,6 +245,28 @@ public class TrafficManageServiceImpl implements TrafficManageService{
240 245 }
241 246  
242 247 /**
  248 + * 加载运管处的站点及序号
  249 + * 上行从1开始,下行顺序续编
  250 + */
  251 + private Map<String, Integer> getStationName2YgcNumberMap (String lineCode){
  252 + Map<String, Integer> resultMap = new HashMap<>();
  253 + List<Map<String, String>> ygcLines = stationRouteRepository.findLineWithYgcByLine(lineCode);
  254 + if(ygcLines != null && ygcLines.size() > 0){
  255 + int size = ygcLines.size();
  256 + Map<String, String> tempMap ;
  257 + int num = 1;
  258 + String key;
  259 + for (int i = 0; i < size; i ++){
  260 + tempMap = ygcLines.get(i);
  261 + key = tempMap.get("lineCode") + "_"+String.valueOf(tempMap.get("directions"))
  262 + + "_"+tempMap.get("stationCode")+ "_"+tempMap.get("stationMark");
  263 + resultMap.put(key,num++);
  264 + }
  265 + }
  266 + return resultMap;
  267 + }
  268 +
  269 + /**
243 270 * 上传线路信息(按in_use上传)
244 271 */
245 272 @Override
... ... @@ -431,7 +458,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
431 458 // 起点站的参数
432 459 otherMap.put("stationMark","B");
433 460 paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap);
434   - sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) + "</FCZDXH>");
  461 + sf.append("<FCZDXH>" + getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) + "</FCZDXH>");
435 462 sf.append("<FCZDBM>"+scheduleRealInfo.getQdzCode()+"</FCZDBM>");
436 463 sf.append("<JHFCSJ>"+scheduleRealInfo.getFcsj()+"</JHFCSJ>");
437 464 sf.append("<DFSJ>"+scheduleRealInfo.getDfsj()+"</DFSJ>");
... ... @@ -441,7 +468,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
441 468 // 终点站的参数
442 469 otherMap.put("stationMark","E");
443 470 paramMap = packageYgcStationNumParam(scheduleRealInfo,otherMap);
444   - sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap) +"</DDZDXH>");
  471 + sf.append("<DDZDXH>"+ getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null) +"</DDZDXH>");
445 472 sf.append("<DDZDBM>"+scheduleRealInfo.getZdzCode()+"</DDZDBM>");
446 473 sf.append("<JHDDSJ>"+scheduleRealInfo.getZdsj()+"</JHDDSJ>");
447 474 sf.append("<SJDDSJ>"+scheduleRealInfo.getZdsjActual()+"</SJDDSJ>");
... ... @@ -768,13 +795,13 @@ public class TrafficManageServiceImpl implements TrafficManageService{
768 795 // 起点站的参数
769 796 otherMap.put("stationMark","B");
770 797 paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap);
771   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>");
  798 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>");
772 799 sBuffer.append("<JHFCSJ>").append(schedulePlanInfo.getFcsj()).append("</JHFCSJ>");
773 800 sBuffer.append("<DDZDMC>").append(schedulePlanInfo.getZdzName()).append("</DDZDMC>");
774 801 // 起点站的参数
775 802 otherMap.put("stationMark","E");
776 803 paramMap = packageYgcStationNumParam(schedulePlanInfo,otherMap);
777   - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>");
  804 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>");
778 805 sBuffer.append("<JHDDSJ>").append(calcDdsj(schedulePlanInfo.getFcsj(),schedulePlanInfo.getBcsj()))
779 806 .append("</JHDDSJ>");
780 807 sBuffer.append("</BC>");
... ... @@ -883,14 +910,14 @@ public class TrafficManageServiceImpl implements TrafficManageService{
883 910 // 起点站的参数
884 911 otherMap.put("stationMark","B");
885 912 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
886   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</ZDXH>");
  913 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</ZDXH>");
887 914 sBuffer.append("<JHFCSJ>").append(changeTimeFormat(ttInfoDetail)).append("</JHFCSJ>");
888 915 sBuffer.append("<DDZDMC>").append(BasicData.stationCode2NameMap.get(ttInfoDetail.getXl().getLineCode()+"_"+ttInfoDetail.getXlDir()
889 916 +"_"+ttInfoDetail.getZdzCode())).append("</DDZDMC>");
890 917 // 起点站的参数
891 918 otherMap.put("stationMark","E");
892 919 paramMap = packageYgcStationNumParam(ttInfoDetail,otherMap);
893   - sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap)).append("</DDXH>");
  920 + sBuffer.append("<DDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paramMap,null)).append("</DDXH>");
894 921 sBuffer.append("<JHDDSJ>").append(calcDdsj(ttInfoDetail.getFcsj(),ttInfoDetail.getBcsj())).append("</JHDDSJ>");
895 922 sBuffer.append("</BC>");
896 923 }
... ... @@ -1214,7 +1241,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1214 1241 *
1215 1242 * @return 站点序号累加后的ID
1216 1243 */
1217   - private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId){
  1244 + private int packagStationXml(List<StationRoute> stationsList,StringBuffer sBuffer,int startId,Map<String, Integer> stationNumMap){
1218 1245 int size = stationsList.size();
1219 1246 StationRoute srRoute;
1220 1247 HashMap<String,String> paraMap;
... ... @@ -1231,7 +1258,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1231 1258 }
1232 1259 paraMap = packageYgcStationNumParam(srRoute,null);
1233 1260 sBuffer.append("<Station>");
1234   - sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap)).append("</ZDXH>");
  1261 + sBuffer.append("<ZDXH>").append(getYgcStationNumByLineCodeAndDirectionAndStationName(paraMap,stationNumMap)).append("</ZDXH>");
1235 1262 sBuffer.append("<SXX>").append(srRoute.getDirections()).append("</SXX>");
1236 1263 sBuffer.append("<ZDMC>").append(srRoute.getStationName()).append("</ZDMC>");
1237 1264 sBuffer.append("<ZDBM>").append(srRoute.getStationCode()).append("</ZDBM>");
... ... @@ -1287,7 +1314,7 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1287 1314 * @param map
1288 1315 * @return 运管处站点序号
1289 1316 */
1290   - private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map){
  1317 + private Integer getYgcStationNumByLineCodeAndDirectionAndStationName(HashMap<String,String> map,Map<String, Integer> stationNumMap){
1291 1318 // 线路编码
1292 1319 String lineCode = map.get("lineCode");
1293 1320 // 线路走向 0:上行 1:下行
... ... @@ -1305,9 +1332,15 @@ public class TrafficManageServiceImpl implements TrafficManageService{
1305 1332 }else if(stationMark.equals("Z")){
1306 1333 marks= new String[]{"Z"};
1307 1334 }
  1335 + // 默认从缓存BasicData.stationName2YgcNumber
  1336 + Map<String, Integer> tempMap = BasicData.stationName2YgcNumber;
  1337 + // 如果传入的stationNumMap不为空,则不是缓存取,而从stationNumMap取
  1338 + if(stationNumMap != null){
  1339 + tempMap = stationNumMap;
  1340 + }
1308 1341 Integer number = null;
1309 1342 for (int i = 0 ;i < marks.length ; i ++){
1310   - number = BasicData.stationName2YgcNumber.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]);
  1343 + number = tempMap.get(lineCode+"_"+direction+"_"+stationCode+"_"+marks[i]);
1311 1344 if(number != null){
1312 1345 break;
1313 1346 }
... ...
src/main/java/com/bsth/service/oil/DlbService.java
... ... @@ -29,5 +29,8 @@ public interface DlbService extends BaseService&lt;Dlb, Integer&gt;{
29 29  
30 30 Map<String, List<Dlb>> updeteHistory(List<Map<String, Object>> list,String date,
31 31 String gsdm,String fgsdm,String line) ;
  32 +
  33 + Map<String, Object> update(Map<String, Object> map);
  34 +
32 35  
33 36 }
... ...
src/main/java/com/bsth/service/oil/YlbService.java
... ... @@ -19,13 +19,16 @@ public interface YlbService extends BaseService&lt;Ylb, Integer&gt;{
19 19  
20 20 Map<String, Object> sumYlb(Map<String, Object> map);
21 21 String checkJsy(Map<String, Object> map);
22   - List<Ylb> oilListMonth(Map<String, Object> map);
  22 + List<Map<String, Object>> oilListMonth(Map<String, Object> map);
23 23 List<Ylb> listYlb(Map<String, Object> map);
24 24 StringBuffer checkNbmmNum(String rq, String gsbm,String fgsbm,String xlbm,String nbbm,int lx);
25 25  
26 26 Map<String, Object> deleteIds(Map<String, Object> map) throws Exception;
27 27  
28 28 Map<String, Object> updateHistory(Map<String, Object> map) throws Exception;
  29 +
  30 + Map<String, Object> update(Map<String, Object> map);
  31 +
29 32  
30 33  
31 34 }
... ...
src/main/java/com/bsth/service/oil/impl/DlbServiceImpl.java
... ... @@ -39,16 +39,19 @@ import com.bsth.entity.oil.Cdl;
39 39 import com.bsth.entity.oil.Cyl;
40 40 import com.bsth.entity.oil.Dlb;
41 41 import com.bsth.entity.oil.Jdl;
42   -import com.bsth.entity.oil.Ylb;
  42 +import com.bsth.entity.oil.Nylog;
43 43 import com.bsth.entity.oil.Ylxxb;
44 44 import com.bsth.entity.search.CustomerSpecs;
  45 +import com.bsth.entity.sys.SysUser;
45 46 import com.bsth.repository.CarsRepository;
46 47 import com.bsth.repository.oil.CdlRepository;
47 48 import com.bsth.repository.oil.CylRepository;
48 49 import com.bsth.repository.oil.DlbRepository;
49 50 import com.bsth.repository.oil.JdlRepository;
  51 +import com.bsth.repository.oil.NylogRepository;
50 52 import com.bsth.repository.oil.YlbRepository;
51 53 import com.bsth.repository.oil.YlxxbRepository;
  54 +import com.bsth.security.util.SecurityUtils;
52 55 import com.bsth.service.impl.BaseServiceImpl;
53 56 import com.bsth.service.oil.DlbService;
54 57 import com.bsth.service.realcontrol.ScheduleRealInfoService;
... ... @@ -59,7 +62,8 @@ import com.bsth.util.BatchSaveUtils;
59 62 public class DlbServiceImpl extends BaseServiceImpl<Dlb,Integer> implements DlbService{
60 63 @Autowired
61 64 DlbRepository repository;
62   -
  65 + @Autowired
  66 + NylogRepository nylogRepository;
63 67 @Autowired
64 68 YlxxbRepository ylxxbRepository;
65 69  
... ... @@ -96,6 +100,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
96 100 calendar.add(Calendar.DAY_OF_MONTH, -1); //设置为前一天
97 101 dBefore = calendar.getTime(); //得到前一天的时间
98 102 String rq=sdf.format(dBefore);
  103 +// String rq="2017-11-02";
99 104 String line="";
100 105 //保留两位小数
101 106 DecimalFormat df = new DecimalFormat("#.00");
... ... @@ -108,7 +113,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
108 113 //当天加电信息表
109 114 List<Jdl> jdlList=jdlRepository.JdlList(rq);
110 115 //前一天所有车辆最后进场班次信息
111   - List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", "");
  116 +// List<Dlb> dlListBe=repository.obtainYlbefore(rq, "", "", "", "");
112 117 List<Cdl> cdyList=cdlRepository.obtainCdl();
113 118 //从排班表中计算出行驶的总里程
114 119 List<Map<String,Object>> listpb=scheduleRealInfoService.yesterdayDataList(line,rq,"","","","");
... ... @@ -140,14 +145,14 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
140 145 Double jzl=0.0;
141 146 if(map.get("seqNumber").toString().equals("1")){
142 147 boolean fage=true;
143   - for (int i = 0; i < dlListBe.size(); i++) {
144   - Dlb dlb=dlListBe.get(i);
145   - if(map.get("clZbh").toString().equals(dlb.getNbbm())){
146   - t.setCzcd(dlb.getJzcd());
147   - fage=false;
148   - break;
149   - }
150   - }
  148 +// for (int i = 0; i < dlListBe.size(); i++) {
  149 +// Dlb dlb=dlListBe.get(i);
  150 +// if(map.get("clZbh").toString().equals(dlb.getNbbm())){
  151 +// t.setCzcd(dlb.getJzcd());
  152 +// fage=false;
  153 +// break;
  154 +// }
  155 +// }
151 156 if(fage){
152 157 for (int y = 0; y < cdyList.size(); y++) {
153 158 Cdl cdl=cdyList.get(y);
... ... @@ -391,8 +396,6 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
391 396  
392 397 }
393 398 }
394   -
395   -
396 399 }
397 400 Double lc= Double.parseDouble(map.get("totalKilometers").toString());
398 401 if(map.get("seqNumber").toString().equals("1")){
... ... @@ -485,7 +488,7 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
485 488 new BatchSaveUtils<Dlb>().saveList2(addList, Dlb.class);
486 489 } catch (Exception e) {
487 490 // TODO: handle exception
488   - if(e.getMessage().indexOf("PK_YLB_UK")>0){
  491 + if(e.getMessage().indexOf("PK_DLB_UK")>0){
489 492 newMap.put("fage", "存在相同数据,数据已经过滤");
490 493 logger.info("获取:存在相同数据,数据已经过滤");
491 494 }
... ... @@ -498,6 +501,15 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
498 501 repository.save(updateList.get(i));
499 502 }
500 503 }
  504 + SysUser user = SecurityUtils.getCurrentUser();
  505 + Nylog nylog=new Nylog();
  506 + nylog.setCreatedate(new Date());
  507 + nylog.setCzmc("获取");
  508 + nylog.setNylx("电");
  509 + nylog.setUserid(user.getUserName());
  510 + nylog.setUsername(user.getName());
  511 + nylog.setCxtj(line+"-"+ date+"-"+gsbm+"-"+fgsbm);
  512 + nylogRepository.save(nylog);
501 513 newMap.put("status", ResponseCode.SUCCESS);
502 514 } catch (Exception e) {
503 515 // TODO Auto-generated catch block
... ... @@ -576,57 +588,56 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
576 588 if(map.get("nbbm_eq")!=null){
577 589 nbbm=map.get("nbbm_eq").toString();
578 590 }
579   - List<Dlb> ylListBe=repository.obtainYlbefore(rq, gsbm, "", xlbm, nbbm);
580   -// List<Cdl> cylList=cdlRepository.obtainCdl(nbbm, gsbm);
581   - List<Dlb> ylbList=repository.obtainDl(rq,gsbm,fgsbm,xlbm,nbbm,"nbbm");
582   - List<Ylxxb> ylxxbList=ylxxbRepository.obtainYlxx(rq,1,gsbm);
583   - for (int i = 0; i < ylxxbList.size(); i++) {
584   - Boolean fage=true;
585   - Ylxxb y1=ylxxbList.get(i);
586   - for(int y=0;y<ylbList.size();y++){
587   - Dlb y2=ylbList.get(y);
588   - if(y1.getNbbm().equals(y2.getNbbm())){
589   - fage=false;
590   - break;
591   - }
  591 +
  592 + String sql="select * from bsth_c_jdl j where j.gs_bm ='"+gsbm+"' "
  593 + + " and j.fgs_bm ='"+fgsbm+"' and rq ='"+rq+"' "
  594 + + "and nbbm not in (select nbbm from bsth_c_dlb d"
  595 + + " where ssgsdm ='"+gsbm+"' and fgsdm ='"+fgsbm+"'"
  596 + + " and rq='"+rq+"')";
  597 + List<Jdl> listJdl=jdbcTemplate.query(sql,
  598 + new RowMapper<Jdl>(){
  599 + @Override
  600 + public Jdl mapRow(ResultSet rs, int rowNum) throws SQLException {
  601 + Jdl s = new Jdl();
  602 + s.setNbbm(rs.getString("nbbm"));
  603 + s.setGsBm(rs.getString("gs_bm"));
  604 + s.setFgsBm(rs.getString("fgs_bm"));
  605 + s.setJdl(rs.getDouble("jdl"));
  606 + s.setRq(rs.getDate("rq"));
  607 + return s;
592 608 }
593   -
594   - if(fage){
595   - Dlb t=new Dlb();
596   - t.setNbbm(y1.getNbbm());
597   - t.setRq(y1.getYyrq());
598   - t.setJsy(y1.getJsy());
599   - t.setCdl(y1.getJzl());
600   - t.setSsgsdm(y1.getGsdm());
601   - String fgsdm="";
602   - if(null!=carsMap.get(y1.getNbbm())){
603   - fgsdm=carsMap.get(y1.getNbbm());
604   - }
605   - t.setFgsdm(fgsdm);
  609 + });
  610 + for (int i = 0; i < listJdl.size(); i++) {
  611 + Jdl j=listJdl.get(i);
  612 + Dlb t=new Dlb();
  613 + Line line= BasicData.nbbm2LineMap.get(j.getNbbm());
  614 + if(null !=line){
  615 + t.setCdl(j.getJdl());
  616 + t.setNbbm(j.getNbbm());
  617 + t.setRq(j.getRq());
  618 + t.setJsy("");
  619 + t.setCdl(j.getJdl());
  620 + t.setSsgsdm(j.getGsBm());
  621 + t.setFgsdm(j.getFgsBm());
  622 + t.setJzcd(100.0);
  623 + t.setCzcd(100.0);
  624 + t.setHd(0.0);
606 625 t.setJcsx(1);
607   - Line line= BasicData.nbbm2LineMap.get(y1.getNbbm());
608   - if(null !=line){
609   - t.setXlbm(line.getLineCode());
610   - boolean status=true;
611   - for (int j = 0; j < ylListBe.size(); j++) {
612   - Dlb b=ylListBe.get(j);
613   - if(b.getNbbm().equals(y1.getNbbm())){
614   - t.setCzcd(b.getJzcd());
615   - status=false;
616   - break;
617   - }
618   - }
619   - if(status){
620   - t.setCzcd(0.0);
621   - }
622   - t.setJzcd(100.0);
623   - t.setHd(0.0);
624   - if(fgsdm.equals(fgsbm)){
625   - repository.save(t);
626   - }
627   - }
  626 + t.setXlbm(line.getLineCode());
  627 + t.setLp("");
  628 + repository.save(t);
628 629 }
629 630 }
  631 +
  632 + SysUser user = SecurityUtils.getCurrentUser();
  633 + Nylog nylog=new Nylog();
  634 + nylog.setCreatedate(new Date());
  635 + nylog.setCzmc("核对");
  636 + nylog.setNylx("电");
  637 + nylog.setUserid(user.getUserName());
  638 + nylog.setUsername(user.getName());
  639 + nylog.setCxtj(xlbm+"-"+ rq+"-"+gsbm+"-"+fgsbm);
  640 + nylogRepository.save(nylog);
630 641 newMap.put("status", ResponseCode.SUCCESS);
631 642 }catch(Exception e){
632 643 newMap.put("status", ResponseCode.ERROR);
... ... @@ -840,6 +851,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
840 851 repository.dlbUpdate(id, czcd, jzcd, hd, sh, shyy, yhlx);
841 852  
842 853 }
  854 +
  855 + SysUser user = SecurityUtils.getCurrentUser();
  856 + Nylog nylog=new Nylog();
  857 + nylog.setCreatedate(new Date());
  858 + nylog.setCzmc("保存全部");
  859 + nylog.setNylx("电");
  860 + nylog.setUserid(user.getUserName());
  861 + nylog.setUsername(user.getName());
  862 + nylog.setCxtj("");
  863 + nylogRepository.save(nylog);
843 864 newMap.put("status", ResponseCode.SUCCESS);
844 865 }catch(Exception e){
845 866 newMap.put("status", ResponseCode.ERROR);
... ... @@ -940,6 +961,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
940 961 }
941 962 t.setJcsx(jcsx);
942 963 repository.save(t);
  964 +
  965 + SysUser user = SecurityUtils.getCurrentUser();
  966 + Nylog nylog=new Nylog();
  967 + nylog.setCreatedate(new Date());
  968 + nylog.setCzmc("手动添加");
  969 + nylog.setNylx("电");
  970 + nylog.setUserid(user.getUserName());
  971 + nylog.setUsername(user.getName());
  972 + nylog.setCxtj("");
  973 + nylogRepository.save(nylog);
943 974 map.put("status", ResponseCode.SUCCESS);
944 975 map.put("t", t);
945 976 return map;
... ... @@ -959,6 +990,16 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
959 990 Integer id =jsonObject.getInteger("id");
960 991 repository.delete(id);
961 992 }
  993 +
  994 + SysUser user = SecurityUtils.getCurrentUser();
  995 + Nylog nylog=new Nylog();
  996 + nylog.setCreatedate(new Date());
  997 + nylog.setCzmc("删除");
  998 + nylog.setNylx("电");
  999 + nylog.setUserid(user.getUserName());
  1000 + nylog.setUsername(user.getName());
  1001 + nylog.setCxtj("");
  1002 + nylogRepository.save(nylog);
962 1003 maps.put("status", ResponseCode.SUCCESS);
963 1004 } catch (Exception e) {
964 1005 maps.put("status", ResponseCode.ERROR);
... ... @@ -983,17 +1024,22 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
983 1024 for (int j = 0; j < dlbList.size(); j++) {
984 1025 Dlb t=dlbList.get(j);
985 1026 boolean fage=true;
986   - for (int i = 0; i < listpbDc.size(); i++) {
987   - Map<String, Object> m = listpbDc.get(i);
988   - if(t.getNbbm().equals(m.get("clZbh").toString())
989   - &&t.getJsy().equals(m.get("jGh").toString())
990   - &&t.getXlbm().equals(m.get("xlBm").toString())
991   - &&t.getLp().equals(m.get("lpName").toString())){
992   - //该条记录不用删除
993   - fage =false;
994   - dlbList_upd.add(t);
  1027 + if(t.getLp().isEmpty()){
  1028 + fage=false;
  1029 + }else{
  1030 + for (int i = 0; i < listpbDc.size(); i++) {
  1031 + Map<String, Object> m = listpbDc.get(i);
  1032 + if(t.getNbbm().equals(m.get("clZbh").toString())
  1033 + &&t.getJsy().equals(m.get("jGh").toString())
  1034 + &&t.getXlbm().equals(m.get("xlBm").toString())
  1035 + &&t.getLp().equals(m.get("lpName").toString())){
  1036 + //该条记录不用删除
  1037 + fage =false;
  1038 + dlbList_upd.add(t);
  1039 + }
995 1040 }
996 1041 }
  1042 +
997 1043 if(fage){
998 1044 dlbList_del.add(t);
999 1045 }
... ... @@ -1170,6 +1216,21 @@ public class DlbServiceImpl extends BaseServiceImpl&lt;Dlb,Integer&gt; implements DlbS
1170 1216 return mapList;
1171 1217 }
1172 1218  
  1219 + @Override
  1220 + public Map<String, Object> update(Map<String, Object> map) {
  1221 + if(map.get("id")!=null){
  1222 + if(map.get("id").toString().length()>0){
  1223 + Integer id=Integer.parseInt(map.get("id").toString());
  1224 + String jsy=map.get("jsy").toString();
  1225 + Dlb t=repository.findOne(id);
  1226 + t.setJsy(jsy);
  1227 + repository.save(t);
  1228 + map.put("status", ResponseCode.SUCCESS);
  1229 + }
  1230 + }
  1231 + return map;
  1232 + }
  1233 +
1173 1234 }
1174 1235  
1175 1236 class NbbmJcsxMap implements Comparator<Map<String, Object>>{
... ...
src/main/java/com/bsth/service/oil/impl/YlbServiceImpl.java
... ... @@ -34,14 +34,19 @@ import com.bsth.entity.Line;
34 34 import com.bsth.entity.mcy_forms.Daily;
35 35 import com.bsth.entity.oil.Cyl;
36 36 import com.bsth.entity.oil.Dlb;
  37 +import com.bsth.entity.oil.Nylog;
37 38 import com.bsth.entity.oil.Ylb;
38 39 import com.bsth.entity.oil.Ylxxb;
39 40 import com.bsth.entity.search.CustomerSpecs;
  41 +import com.bsth.entity.sys.SysUser;
40 42 import com.bsth.repository.CarsRepository;
  43 +import com.bsth.repository.LineRepository;
41 44 import com.bsth.repository.oil.CylRepository;
42 45 import com.bsth.repository.oil.DlbRepository;
  46 +import com.bsth.repository.oil.NylogRepository;
43 47 import com.bsth.repository.oil.YlbRepository;
44 48 import com.bsth.repository.oil.YlxxbRepository;
  49 +import com.bsth.security.util.SecurityUtils;
45 50 import com.bsth.service.impl.BaseServiceImpl;
46 51 import com.bsth.service.oil.DlbService;
47 52 import com.bsth.service.oil.YlbService;
... ... @@ -57,7 +62,8 @@ import javassist.bytecode.stackmap.BasicBlock.Catch;
57 62 public class YlbServiceImpl extends BaseServiceImpl<Ylb,Integer> implements YlbService{
58 63 @Autowired
59 64 YlbRepository repository;
60   -
  65 + @Autowired
  66 + NylogRepository nylogRepository;
61 67 @Autowired
62 68 YlxxbRepository ylxxbRepository;
63 69  
... ... @@ -73,6 +79,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
73 79 @Autowired
74 80 CarsRepository carsRepository;
75 81  
  82 +
  83 + @Autowired
  84 + LineRepository lineRepository;
  85 +
76 86 @Autowired
77 87 ScheduleRealInfoService scheduleRealInfoService;
78 88  
... ... @@ -198,13 +208,12 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
198 208 }
199 209  
200 210 }
201   -
202   -
203   - }
  211 + }
204 212  
205 213 }
206 214 if(addList.size()>0){
207 215 try {
  216 +
208 217 new BatchSaveUtils<Ylb>().saveList2(addList, Ylb.class);
209 218 } catch (Exception e) {
210 219 // TODO: handle exception
... ... @@ -270,8 +279,6 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
270 279  
271 280 // 前一天所有车辆最后进场班次信息
272 281 List<Ylb> ylListBe = this.listByRqJcsx(rq, gsbm, fgsbm, line, nbbm);
273   -// List<Ylb> ylListBe =repository.listMaxRqJcsx(rq, gsbm, fgsbm, line, nbbm);
274   -
275 282 List<Cyl> clyList = cylRepository.obtainCyl(nbbm,gsbm);
276 283  
277 284 // 从排班表中计算出行驶的总里程
... ... @@ -479,6 +486,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
479 486 repository.save(updateList.get(i));
480 487 }
481 488 }
  489 + SysUser user = SecurityUtils.getCurrentUser();
  490 + Nylog nylog=new Nylog();
  491 + nylog.setCreatedate(new Date());
  492 + nylog.setCzmc("获取加存油");
  493 + nylog.setNylx("油");
  494 + nylog.setUserid(user.getUserName());
  495 + nylog.setUsername(user.getName());
  496 + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+line+"-"+nbbm+"-"+sxtj);
  497 + nylogRepository.save(nylog);
482 498 newMap.put("status", ResponseCode.SUCCESS);
483 499 } catch (Exception e) {
484 500 // TODO Auto-generated catch block
... ... @@ -669,6 +685,17 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
669 685 }
670 686 }
671 687 }
  688 +
  689 + SysUser user = SecurityUtils.getCurrentUser();
  690 + Nylog nylog=new Nylog();
  691 + nylog.setCreatedate(new Date());
  692 + nylog.setCzmc("进场等于出场");
  693 + nylog.setNylx("油");
  694 + nylog.setUserid(user.getUserName());
  695 + nylog.setUsername(user.getName());
  696 + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-"+sxtj);
  697 +
  698 + nylogRepository.save(nylog);
672 699 } catch (Exception e) {
673 700 map2.put("status", ResponseCode.ERROR);
674 701 logger.error("save erro.", e);
... ... @@ -820,6 +847,16 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
820 847 }
821 848 }
822 849 }
  850 +
  851 + SysUser user = SecurityUtils.getCurrentUser();
  852 + Nylog nylog=new Nylog();
  853 + nylog.setCreatedate(new Date());
  854 + nylog.setCzmc("核对加注量");
  855 + nylog.setNylx("油");
  856 + nylog.setUserid(user.getUserName());
  857 + nylog.setUsername(user.getName());
  858 + nylog.setCxtj(rq+"-"+gsbm+"-"+fgsbm+"-"+xlbm+"-"+nbbm+"-");
  859 + nylogRepository.save(nylog);
823 860 newMap.put("status", ResponseCode.SUCCESS);
824 861 }catch(Exception e){
825 862 newMap.put("status", ResponseCode.ERROR);
... ... @@ -832,7 +869,10 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
832 869  
833 870  
834 871 @Override
835   - public List<Ylb> oilListMonth(Map<String, Object> map) {
  872 + public List<Map<String, Object>> oilListMonth(Map<String, Object> map) {
  873 + SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
  874 + sdfSimple = new SimpleDateFormat("yyyyMMdd");
  875 +
836 876 String type=map.get("type").toString();
837 877 String date=map.get("date").toString().trim();
838 878 String gsdm=map.get("gsdm").toString();
... ... @@ -840,7 +880,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
840 880 String date2=date.substring(0, 8)+"01";
841 881 String lineStr="";
842 882 String line =map.get("line").toString().trim();
843   - if(line !=null && !line.equals("")){
  883 + /*if(line !=null && !line.equals("")){
844 884 lineStr =" and xlbm= '"+ line +"'";
845 885 }else{
846 886 lineStr =" and ssgsdm='"+gsdm+"' and fgsdm ='"+fgsdm+"' ";
... ... @@ -868,23 +908,86 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
868 908 s.setJzyl(rs.getDouble("jzyl"));
869 909 return s;
870 910 }
871   - });
  911 + }); */
872 912  
873   - if(type != null && type.equals("export")){
874   - SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
875   - sdfSimple = new SimpleDateFormat("yyyyMMdd");
876   -
877   - List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
878   - for(Ylb ylb : list){
879   - Map<String, Object> m = new HashMap<String, Object>();
880   - m.put("nbbm", ylb.getNbbm()!=null?ylb.getNbbm():"");
881   - m.put("rq", ylb.getRq()!=null?sdfMonth.format(ylb.getRq()):"");
882   - m.put("jzyl", ylb.getJzyl()!=null?ylb.getJzyl():"");
883   - mapList.add(m);
  913 + double qtyy=0.0;//其他用油
  914 + double cdyy=0.0;//车队用油
  915 + double byyy=0.0;//保养用油
  916 + double cjxx=0.0;//车间小修
  917 + double cjgb=0.0;//车间高保
  918 + double fyyyhj=0.0;//非营运用油合计
  919 + List<Ylb> listYlb=repository.listByMonthJcsx(date2, date, gsdm, fgsdm, line);
  920 +
  921 + Map<String, Object> ms=new HashMap<String,Object>();
  922 + List<Ylb> list=new ArrayList<Ylb>();
  923 + for (int i = 0; i < listYlb.size(); i++) {
  924 + Ylb t=listYlb.get(i);
  925 + fyyyhj =Arith.add(fyyyhj, t.getSh());
  926 + if(t.getShyy()==null){
  927 + qtyy=Arith.add(qtyy, t.getSh());
  928 + }else{
  929 + if(t.getShyy().equals("6")){
  930 + cdyy=Arith.add(cdyy, t.getSh());
  931 + }else if(t.getShyy().equals("2")){
  932 + byyy=Arith.add(byyy, t.getSh());
  933 + }else if(t.getShyy().equals("7")){
  934 + cjxx=Arith.add(cjxx, t.getSh());
  935 + }else if(t.getShyy().equals("8")){
  936 + cjgb=Arith.add(cjgb, t.getSh());
  937 + }else{
  938 + qtyy=Arith.add(qtyy, t.getSh());
  939 + }
  940 + }
  941 + if(ms.get(t.getNbbm())==null){
  942 + ms.put(t.getNbbm(), t.getNbbm());
  943 + list.add(t);
884 944 }
  945 + }
  946 +
  947 + List<Map<String, Object>> mapList = new ArrayList<Map<String, Object>>();
  948 + int size = 0;
  949 + Map<String, Object> m_ = new HashMap<String, Object>();
  950 + double ycyhj=0.0;
  951 + for(Ylb ylb : list){
  952 + ycyhj=Arith.add(ycyhj, ylb.getJzyl());
  953 + int x=size%3;
  954 + if(x==0 && size>0){
  955 + mapList.add(m_);
  956 + m_ = new HashMap<String, Object>();
  957 + }
  958 + size++;
  959 + m_.put("xh"+x, size);
  960 + m_.put("nbbm"+x, ylb.getNbbm()!=null?ylb.getNbbm():"");
  961 + m_.put("rq"+x, ylb.getRq()!=null?sdfMonth.format(ylb.getRq()):"");
  962 + m_.put("jzyl"+x, ylb.getJzyl()!=null?ylb.getJzyl():"");
885 963  
  964 + }
  965 + if(m_.get("nbbm0")!=null){
  966 + if(m_.get("nbbm1")==null){
  967 + m_.put("xh1", "");
  968 + m_.put("nbbm1" , "");
  969 + m_.put("rq1" , "");
  970 + m_.put("jzyl1" , "");
  971 + }
  972 + if(m_.get("nbbm2")==null){
  973 + m_.put("xh2", "");
  974 + m_.put("nbbm2" , "");
  975 + m_.put("rq2" , "");
  976 + m_.put("jzyl2" , "");
  977 + }
  978 + mapList.add(m_);
  979 + }
  980 +
  981 + if(type != null && type.equals("export")){
886 982 List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
887 983 Map<String, Object> m = new HashMap<String, Object>();
  984 + m.put("ycyhj", ycyhj);
  985 + m.put("qtyy", qtyy);
  986 + m.put("cdyy", cdyy);
  987 + m.put("byyy", byyy);
  988 + m.put("cjxx", cjxx);
  989 + m.put("cjgb", cjgb);
  990 + m.put("fyyyhj", fyyyhj);
888 991 ReportUtils ee = new ReportUtils();
889 992 try {
890 993 listI.add(mapList.iterator());
... ... @@ -895,9 +998,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
895 998 // TODO: handle exception
896 999 e.printStackTrace();
897 1000 }
  1001 + }else{
  1002 + m_=new HashMap<String,Object>();
  1003 + m_.put("xh0", "99");
  1004 + m_.put("nbbm0", "存油合计:"+ycyhj +" 非营运用油: 其他用油:"+qtyy +",车队:"+cdyy+",保养用油:"+byyy
  1005 + +",车间(小修):"+cjxx+",车间(高保):"+cjgb+",非营运用油合计:"+fyyyhj);
  1006 + mapList.add(m_);
898 1007 }
899 1008  
900   - return list;
  1009 + return mapList;
901 1010 }
902 1011  
903 1012 @Override
... ... @@ -1160,7 +1269,15 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1160 1269 repository.ylbUpdate(id, czyl, jzyl, yh, sh, shyy, ns, rylx,yhlx);
1161 1270 }
1162 1271 // List<Map<String, Object>> list=(List<Map<String, Object>>) map.get("ylbList");
1163   -
  1272 + SysUser user = SecurityUtils.getCurrentUser();
  1273 + Nylog nylog=new Nylog();
  1274 + nylog.setCreatedate(new Date());
  1275 + nylog.setCzmc("保存全部");
  1276 + nylog.setNylx("油");
  1277 + nylog.setUserid(user.getUserName());
  1278 + nylog.setUsername(user.getName());
  1279 + nylog.setCxtj("");
  1280 + nylogRepository.save(nylog);
1164 1281 newMap.put("status", ResponseCode.SUCCESS);
1165 1282 }catch(Exception e){
1166 1283 newMap.put("status", ResponseCode.ERROR);
... ... @@ -1291,6 +1408,16 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1291 1408 }
1292 1409 newMap.put("status", ResponseCode.SUCCESS);
1293 1410 }
  1411 +
  1412 + SysUser user = SecurityUtils.getCurrentUser();
  1413 + Nylog nylog=new Nylog();
  1414 + nylog.setCreatedate(new Date());
  1415 + nylog.setCzmc("拆分");
  1416 + nylog.setNylx("油");
  1417 + nylog.setUserid(user.getUserName());
  1418 + nylog.setUsername(user.getName());
  1419 + nylog.setCxtj("");
  1420 + nylogRepository.save(nylog);
1294 1421 } catch (Exception e) {
1295 1422 newMap.put("status", ResponseCode.ERROR);
1296 1423 logger.error("save erro.", e);
... ... @@ -1349,6 +1476,16 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1349 1476 }
1350 1477 t.setJcsx(jcsx);
1351 1478 repository.save(t);
  1479 +
  1480 + SysUser user = SecurityUtils.getCurrentUser();
  1481 + Nylog nylog=new Nylog();
  1482 + nylog.setCreatedate(new Date());
  1483 + nylog.setCzmc("手动添加");
  1484 + nylog.setNylx("油");
  1485 + nylog.setUserid(user.getUserName());
  1486 + nylog.setUsername(user.getName());
  1487 + nylog.setCxtj("");
  1488 + nylogRepository.save(nylog);
1352 1489 map.put("status", ResponseCode.SUCCESS);
1353 1490 map.put("t", t);
1354 1491 return map;
... ... @@ -1367,6 +1504,16 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1367 1504 Integer id =jsonObject.getInteger("id");
1368 1505 repository.delete(id);
1369 1506 }
  1507 +
  1508 + SysUser user = SecurityUtils.getCurrentUser();
  1509 + Nylog nylog=new Nylog();
  1510 + nylog.setCreatedate(new Date());
  1511 + nylog.setCzmc("删除");
  1512 + nylog.setNylx("油");
  1513 + nylog.setUserid(user.getUserName());
  1514 + nylog.setUsername(user.getName());
  1515 + nylog.setCxtj("");
  1516 + nylogRepository.save(nylog);
1370 1517 maps.put("status", ResponseCode.SUCCESS);
1371 1518 } catch (Exception e) {
1372 1519 maps.put("status", ResponseCode.ERROR);
... ... @@ -1429,8 +1576,14 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1429 1576 try{
1430 1577 String date = map.get("date").toString();
1431 1578 String line = map.get("line").toString();
1432   - String gsdm = map.get("gsdm").toString();
1433   - String fgsdm = map.get("fgsdm").toString();
  1579 + List<Line> listLine=lineRepository.findLineByCode(line);
  1580 + String gsdm ="";
  1581 + String fgsdm ="";
  1582 + if(listLine.size()>0){
  1583 + Line l=listLine.get(0);
  1584 + gsdm=l.getCompany();
  1585 + fgsdm=l.getBrancheCompany();
  1586 + }
1434 1587  
1435 1588 List<Map<String, Object>> listpbYc=new ArrayList<Map<String, Object>>();//油车数据
1436 1589 List<Map<String, Object>> listpbDc=new ArrayList<Map<String, Object>>();//电车数据
... ... @@ -1462,15 +1615,19 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1462 1615 for (int j = 0; j < ylbList.size(); j++) {
1463 1616 Ylb t=ylbList.get(j);
1464 1617 boolean fage=true;
1465   - for (int i = 0; i < listpbYc.size(); i++) {
1466   - Map<String, Object> m = listpbYc.get(i);
1467   - if(t.getNbbm().equals(m.get("clZbh").toString())
1468   - &&t.getJsy().equals(m.get("jGh").toString())
1469   - &&t.getXlbm().equals(m.get("xlBm").toString())
1470   - &&t.getLp().equals(m.get("lpName").toString())){
1471   - //该条记录不用删除
1472   - fage =false;
1473   - ylbList_upd.add(t);
  1618 + if(t.getLp().isEmpty()){
  1619 + fage=false;
  1620 + }else{
  1621 + for (int i = 0; i < listpbYc.size(); i++) {
  1622 + Map<String, Object> m = listpbYc.get(i);
  1623 + if(t.getNbbm().equals(m.get("clZbh").toString())
  1624 + &&t.getJsy().equals(m.get("jGh").toString())
  1625 + &&t.getXlbm().equals(m.get("xlBm").toString())
  1626 + &&t.getLp().equals(m.get("lpName").toString())){
  1627 + //该条记录不用删除
  1628 + fage =false;
  1629 + ylbList_upd.add(t);
  1630 + }
1474 1631 }
1475 1632 }
1476 1633 if(fage){
... ... @@ -1478,7 +1635,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1478 1635 }
1479 1636  
1480 1637 }
1481   -
  1638 + String nbbmStr="";
1482 1639 List<Ylb> list=new ArrayList<Ylb>();
1483 1640 /*
1484 1641 * 第一步 修改车辆里程 和加注量
... ... @@ -1486,7 +1643,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1486 1643 Map<String, Object> ylMap=new HashMap<String, Object>();
1487 1644 for (int x = 0; x < listpbYc.size(); x++) {
1488 1645 String type = "add";
1489   - Map<String, Object> maps = listpb.get(x);
  1646 + Map<String, Object> maps = listpbYc.get(x);
1490 1647 // 判断驾驶员驾驶的该车辆是否已经存入了(查出的结果集中日期是相同的,根据驾驶员、内部编号、线路编码判断)
1491 1648 Ylb t = new Ylb();
1492 1649 for (int k = 0; k < ylbList_upd.size(); k++) {
... ... @@ -1499,43 +1656,45 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1499 1656 type = "update";
1500 1657 }
1501 1658 }
1502   - // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
1503   - if (maps.get("seqNumber").toString().equals("1")) {
1504   - boolean fage = true;
1505   - for (int i = 0; i < ylListBe.size(); i++) {
1506   - Ylb ylb = ylListBe.get(i);
1507   - if (maps.get("clZbh").toString().equals(ylb.getNbbm())) {
1508   - if(ylb.getJzyl()>0){
1509   - t.setCzyl(ylb.getJzyl());
1510   - fage = false;
1511   - break;
  1659 + if(type.equals("add")){
  1660 + // 当日的第一个班次,出场油量等于前一天的最后一个班次的进场油量
  1661 + if (maps.get("seqNumber").toString().equals("1")) {
  1662 + boolean fage = true;
  1663 + for (int i = 0; i < ylListBe.size(); i++) {
  1664 + Ylb ylb = ylListBe.get(i);
  1665 + if (maps.get("clZbh").toString().equals(ylb.getNbbm())) {
  1666 + if(ylb.getJzyl()>0){
  1667 + t.setCzyl(ylb.getJzyl());
  1668 + fage = false;
  1669 + break;
  1670 + }
1512 1671 }
1513 1672 }
1514   - }
1515   - if (fage) {
1516   - for (int y = 0; y < clyList.size(); y++) {
1517   - Cyl cyl = clyList.get(y);
1518   - if (maps.get("clZbh").toString().equals(cyl.getNbbm())) {
1519   - if(cyl!=null){
1520   - if(cyl.getCyl()>=0){
1521   - t.setCzyl(cyl.getCyl());
1522   - fage = false;
1523   - break;
1524   - }else {
1525   - if(cyl.getCxrl()!=null){
1526   - if(cyl.getCxrl()>0){
1527   - t.setCzyl(cyl.getCxrl());
1528   - fage = false;
1529   - break;
  1673 + if (fage) {
  1674 + for (int y = 0; y < clyList.size(); y++) {
  1675 + Cyl cyl = clyList.get(y);
  1676 + if (maps.get("clZbh").toString().equals(cyl.getNbbm())) {
  1677 + if(cyl!=null){
  1678 + if(cyl.getCyl()>=0){
  1679 + t.setCzyl(cyl.getCyl());
  1680 + fage = false;
  1681 + break;
  1682 + }else {
  1683 + if(cyl.getCxrl()!=null){
  1684 + if(cyl.getCxrl()>0){
  1685 + t.setCzyl(cyl.getCxrl());
  1686 + fage = false;
  1687 + break;
  1688 + }
1530 1689 }
1531 1690 }
1532 1691 }
1533 1692 }
1534 1693 }
1535 1694 }
1536   - }
1537   - if (fage) {
1538   - t.setCzyl(0.0);
  1695 + if (fage) {
  1696 + t.setCzyl(0.0);
  1697 + }
1539 1698 }
1540 1699 }
1541 1700  
... ... @@ -1548,7 +1707,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1548 1707 Ylxxb ylxxb = ylxxList.get(i);
1549 1708 if (maps.get("clZbh").toString().equals(ylxxb.getNbbm())
1550 1709 && maps.get("jGh").toString().equals(ylxxb.getJsy())
1551   - && ylxxb.getJylx()>0) {
  1710 + && ylxxb.getJylx()==1) {
1552 1711 if(ylxxb.getJzl()>0){
1553 1712 fage2=true;
1554 1713 }
... ... @@ -1561,7 +1720,7 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1561 1720 Ylxxb ylxxb = ylxxList.get(j);
1562 1721 if (maps.get("clZbh").toString().equals(ylxxb.getNbbm())
1563 1722 && maps.get("jGh").toString().equals(ylxxb.getJsy())
1564   - && ylxxb.getJylx()>0) {
  1723 + && ylxxb.getJylx()==1) {
1565 1724 jzl =Arith.add(jzl, ylxxb.getJzl());
1566 1725 }
1567 1726 }
... ... @@ -1592,21 +1751,114 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1592 1751 t.setLp(maps.get("lpName")==null?"":maps.get("lpName").toString());
1593 1752 if(!(t.getSsgsdm().equals("") || t.getFgsdm().equals(""))){
1594 1753 if(type.equals("add")){
  1754 + if(nbbmStr.indexOf(t.getNbbm())<0){
  1755 + nbbmStr +=t.getNbbm()+",";
  1756 + }
1595 1757 t.setCreatetime(new Date());
1596 1758 }else{
1597 1759 t.setUpdatetime(new Date());
1598 1760 }
1599 1761 }
1600   - repository.save(t);
  1762 + try {
  1763 + repository.save(t);
  1764 + } catch (Exception e) {
  1765 + // TODO: handle exception
  1766 + if(e.getMessage().indexOf("PK_YLB_UK")>0){
  1767 + newMap.put("fage", "存在相同数据,数据已经过滤");
  1768 + logger.info("油量存在相同数据,数据已经过滤");
  1769 + }
  1770 + }
1601 1771  
1602 1772 }
1603 1773  
1604 1774 for (int i = 0; i < ylbList_del.size(); i++) {
1605 1775 Ylb y=ylbList_del.get(i);
  1776 + if(nbbmStr.indexOf(y.getNbbm())<0){
  1777 + nbbmStr +=y.getNbbm()+",";
  1778 + }
1606 1779 repository.delete(y.getId());
1607 1780 }
  1781 +
  1782 + //重新计算删除了的或者新增了的车的车的油耗信息(考虑车辆可能跨线路,从分公司赛选计算)
  1783 + double czyl=0.0;
  1784 + List<Ylb> iterator2=this.listOrderBy(date,gsdm,fgsdm,line,"","nbbm,jcsx");
  1785 + String[] nbbms=nbbmStr.split(",");
  1786 + for (int i = 0; i < nbbms.length; i++) {
  1787 + String clzbm=nbbms[i];
  1788 + // 得到一天总的加油和里程(根据车,时间)
  1789 + List<Object[]> sumList = repository.sumLcYl(clzbm, sdf.parse(date),"",gsdm,fgsdm);
  1790 + // 保存总的加油量
  1791 + Double jzl = 0.0;
  1792 + // 保存总的里程
  1793 + Double zlc = 0.0;
  1794 + for (int j = 0; j < sumList.size(); j++) {
  1795 + jzl = Arith.add(jzl, Double.valueOf(sumList.get(j)[0].toString()));
  1796 + zlc = Arith.add(zlc, Double.valueOf(sumList.get(j)[1].toString()));
  1797 + }
  1798 + // 保留两位小数
  1799 + DecimalFormat df = new DecimalFormat("#.00");
  1800 + Double zyl = 0.0;
  1801 + Double nextJzyl = 0.0;
  1802 + for (int j = 0; j < iterator2.size(); j++) {
  1803 + Ylb t = iterator2.get(j);
  1804 + if(t.getNbbm().equals(clzbm)){
  1805 + if (t.getJcsx() == 1) {
  1806 + // 进场等于出场的操作 既 最后进场存油量等于第一次的出场存油量
  1807 + czyl = t.getCzyl();
  1808 + zyl =jzl;
  1809 + Double yh=0.0;
  1810 + if(zlc>0 ){
  1811 + yh = Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  1812 + }
  1813 + nextJzyl =Arith.sub( Arith.add(t.getJzl(), t.getCzyl()),yh);
  1814 + //把进场油量的小数和整数分别取出
  1815 + if(zlc>0 && t.getZlc()>0){
  1816 + long l=Math.round(nextJzyl);
  1817 + double ylxs=l*100/100;
  1818 + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs));
  1819 + t.setYh(yh);
  1820 + t.setJzyl(ylxs);
  1821 + nextJzyl=ylxs;
  1822 + }else{
  1823 + t.setYh(yh);
  1824 + t.setJzyl(nextJzyl);
  1825 + }
  1826 + } else {
  1827 + t.setCzyl(nextJzyl);
  1828 + Double yh=0.0;
  1829 + if(zlc>0){
  1830 + yh= Double.parseDouble(df.format(zyl * (t.getZlc() / zlc)));
  1831 + }
  1832 + nextJzyl =Arith.sub( Arith.add(t.getJzl(),nextJzyl),yh);
  1833 + if(zlc>0 && t.getZlc()>0){
  1834 + long l=0l;
  1835 + double ylxs=0.0;
  1836 + if(j==iterator2.size()-1){
  1837 + ylxs=czyl;
  1838 + }else{
  1839 + if(iterator2.get(j+1).getNbbm().equals(t.getNbbm())){
  1840 + l=Math.round(nextJzyl);
  1841 + ylxs=l*100/100;
  1842 + }else{
  1843 + ylxs=czyl;
  1844 + }
  1845 +
  1846 + }
  1847 + yh=Arith.add(yh, Arith.sub(nextJzyl,ylxs));
  1848 + t.setYh(yh);
  1849 + t.setJzyl(ylxs);
  1850 + nextJzyl=ylxs;
  1851 + }else{
  1852 + t.setYh(yh);
  1853 + t.setJzyl(nextJzyl);
  1854 + }
  1855 + }
  1856 + repository.save(t);
  1857 + }
  1858 + }
  1859 + }
  1860 +
1608 1861 //重新统计油车数据结束
1609   -
1610 1862  
1611 1863  
1612 1864 //重新获取电耗数据开始
... ... @@ -1619,9 +1871,27 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1619 1871 List<Dlb> updDlb=mapList.get("updList");
1620 1872 for (int i = 0; i < updDlb.size(); i++) {
1621 1873 Dlb d=updDlb.get(i);
1622   - dlbRepository.save(d);
  1874 + try {
  1875 + dlbRepository.save(d);
  1876 + } catch (Exception e) {
  1877 + // TODO: handle exception
  1878 + if(e.getMessage().indexOf("PK_DLB_UK")>0){
  1879 + newMap.put("fage", "存在相同数据,数据已经过滤");
  1880 + logger.info("电量存在相同数据,数据已经过滤");
  1881 + }
  1882 + }
1623 1883 }
1624 1884 //重新获取电耗数据结束
  1885 +
  1886 + SysUser user = SecurityUtils.getCurrentUser();
  1887 + Nylog nylog=new Nylog();
  1888 + nylog.setCreatedate(new Date());
  1889 + nylog.setCzmc("重新统计");
  1890 + nylog.setNylx("油");
  1891 + nylog.setUserid(user.getUserName());
  1892 + nylog.setUsername(user.getName());
  1893 + nylog.setCxtj(line+"-"+ date+"-"+gsdm+"-"+fgsdm);
  1894 + nylogRepository.save(nylog);
1625 1895 newMap.put("status", ResponseCode.SUCCESS);
1626 1896 }catch(Exception e){
1627 1897 // TODO Auto-generated catch block
... ... @@ -1646,4 +1916,19 @@ public class YlbServiceImpl extends BaseServiceImpl&lt;Ylb,Integer&gt; implements YlbS
1646 1916 }
1647 1917 return list_;
1648 1918 }
  1919 +
  1920 + @Override
  1921 + public Map<String, Object> update(Map<String, Object> map) {
  1922 + if(map.get("id")!=null){
  1923 + if(map.get("id").toString().length()>0){
  1924 + Integer id=Integer.parseInt(map.get("id").toString());
  1925 + String jsy=map.get("jsy").toString();
  1926 + Ylb t=repository.findOne(id);
  1927 + t.setJsy(jsy);
  1928 + repository.save(t);
  1929 + map.put("status", ResponseCode.SUCCESS);
  1930 + }
  1931 + }
  1932 + return map;
  1933 + }
1649 1934 }
... ...
src/main/java/com/bsth/service/oil/impl/YlxxbServiceImpl.java
... ... @@ -2,6 +2,7 @@ package com.bsth.service.oil.impl;
2 2  
3 3 import java.sql.ResultSet;
4 4 import java.sql.SQLException;
  5 +import java.text.DecimalFormat;
5 6 import java.text.ParseException;
6 7 import java.text.SimpleDateFormat;
7 8 import java.util.ArrayList;
... ... @@ -130,6 +131,8 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
130 131 // Ylxxb ylxxb=repository.findOne(id);
131 132 // ylxxb.setJsy(jsy);
132 133 // repository.save(ylxxb);
  134 + DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
  135 +
133 136 String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
134 137 JSONArray jsonArray=JSONArray.parseArray(json);
135 138 JSONObject jsonObject;
... ... @@ -150,7 +153,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
150 153 ylxxbUpdate.setNbbm(ylxxb.getNbbm());
151 154 ylxxbUpdate.setYyrq(ylxxb.getYyrq());
152 155 ylxxbUpdate.setCreatetime(new Date());
153   - ylxxbUpdate.setTj(ylxxb.getNbbm()+"_"+ylxxb.getJsy()+"_"+String.valueOf(ylxxb.getJzl()));
  156 + ylxxbUpdate.setTj(ylxxb.getNbbm()+"_"+ylxxb.getJsy()+"_"+decimalFormat.format(ylxxb.getJzl()));
154 157 ylxxbUpdate.setZt(3);
155 158 updateRepository.save(ylxxbUpdate);
156 159 ylxxb.setJsy(jsy);
... ... @@ -232,6 +235,8 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
232 235 // repository.save(ylxxb);
233 236 String json =StringEscapeUtils.unescapeHtml4(map.get("ylbList").toString());
234 237 JSONArray jsonArray=JSONArray.parseArray(json);
  238 + DecimalFormat decimalFormat = new DecimalFormat("###################.###########");
  239 +
235 240 JSONObject jsonObject;
236 241 for (int x = 0; x < jsonArray.size(); x++) {
237 242 jsonObject=jsonArray.getJSONObject(x);
... ... @@ -250,7 +255,7 @@ public class YlxxbServiceImpl extends BaseServiceImpl&lt;Ylxxb,Integer&gt; implements
250 255 ylxxbUpdate.setNbbm(nbbm);
251 256 ylxxbUpdate.setYyrq(ylxxb.getYyrq());
252 257 ylxxbUpdate.setCreatetime(new Date());
253   - ylxxbUpdate.setTj(nbbm+"_"+ylxxb.getJsy()+"_"+String.valueOf(ylxxb.getJzl()));
  258 + ylxxbUpdate.setTj(nbbm+"_"+ylxxb.getJsy()+"_"+decimalFormat.format(ylxxb.getJzl()));
254 259 ylxxbUpdate.setZt(2);
255 260 updateRepository.save(ylxxbUpdate);
256 261 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ChildTaskPlanServiceImpl.java
... ... @@ -18,6 +18,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
18 18 import org.springframework.stereotype.Service;
19 19  
20 20 import javax.transaction.Transactional;
  21 +import java.util.Date;
21 22 import java.util.HashMap;
22 23 import java.util.Map;
23 24  
... ... @@ -78,7 +79,7 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
78 79 ccServiceSch.setScheduleDateStr(sch.getScheduleDateStr());
79 80 ccServiceSch.setRealExecDate(sch.getRealExecDate());
80 81  
81   - ccServiceSch.setId(null);
  82 + ccServiceSch.setId(dayOfSchedule.getId());
82 83 ccServiceSch.setSpId(null);
83 84 ccServiceSch.setClZbh(t.getNbbm());
84 85 ccServiceSch.setCcService(true);
... ... @@ -96,6 +97,7 @@ public class ChildTaskPlanServiceImpl extends BaseServiceImpl&lt;ChildTaskPlan, Lon
96 97 ccServiceSch.setZdsjActual(ccServiceSch.getZdsj());
97 98 ccServiceSch.setRemarks(t.getRemarks());
98 99 ccServiceSch.setStatus(2);
  100 + ccServiceSch.setCreateDate(new Date());
99 101 if("1".equals(t.getType2())){
100 102 ccServiceSch.setBcType("normal");
101 103 }
... ...
src/main/java/com/bsth/service/realcontrol/impl/ScheduleRealInfoServiceImpl.java
... ... @@ -77,7 +77,7 @@ import org.springframework.jdbc.core.JdbcTemplate;
77 77 import org.springframework.jdbc.core.RowMapper;
78 78 import org.springframework.stereotype.Service;
79 79  
80   -import java.io.*;
  80 +import java.io.File;
81 81 import java.sql.ResultSet;
82 82 import java.sql.SQLException;
83 83 import java.text.DecimalFormat;
... ... @@ -85,8 +85,6 @@ import java.text.ParseException;
85 85 import java.text.SimpleDateFormat;
86 86 import java.util.*;
87 87 import java.util.regex.Pattern;
88   -import java.util.zip.ZipEntry;
89   -import java.util.zip.ZipOutputStream;
90 88  
91 89 @Service
92 90 public class ScheduleRealInfoServiceImpl extends BaseServiceImpl<ScheduleRealInfo, Long>
... ... @@ -503,6 +501,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
503 501 return rs;
504 502 }
505 503  
  504 + t.setId(dayOfSchedule.getId());
506 505 //实时入库
507 506 rs = super.save(t);
508 507 } catch (Exception e) {
... ... @@ -570,17 +569,20 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
570 569 //公司 和 分公司名称
571 570 t.setGsName(BasicData.businessCodeNameMap.get(t.getGsBm()));
572 571 t.setFgsName(BasicData.businessFgsCodeNameMap.get(t.getFgsBm() + "_" + t.getGsBm()));
573   -
  572 + t.setCreateDate(new Date());
574 573 t.setScheduleDateStr(schDate);
575 574 t.setScheduleDate(sdfyyyyMMdd.parse(schDate));
576 575 t.setRealExecDate(schDate);
  576 +
577 577 t.setCreateBy(user);
578 578 t.setSflj(true);
579 579 t.setLate(false);
580 580 t.setDfsj(t.getFcsj());
581 581 t.setZdsjT(sdfyyyyMMddHHmm.parse(schDate + t.getZdsj()).getTime());
582 582 t.setJhlcOrig(t.getJhlc());
583   -
  583 + t.setCreateDate(new Date());
  584 + t.setUpdateDate(new Date());
  585 + t.setSpId(-1L);
584 586 //起终点名称
585 587 String prefix = t.getXlBm() + "_" + t.getXlDir() + "_";
586 588 t.setQdzName(BasicData.getStationNameByCode(t.getQdzCode(), prefix));
... ... @@ -603,6 +605,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
603 605 return rs;
604 606 }
605 607  
  608 + t.setId(dayOfSchedule.getId());
606 609 //实时入库
607 610 super.save(t);
608 611  
... ... @@ -3344,6 +3347,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
3344 3347 if("major".equals(bcType)){
3345 3348 sch.setMajorStationName(majorStationName);
3346 3349 }
  3350 +
  3351 + dayOfSchedule.save(sch);
3347 3352 }
3348 3353 } catch (Exception e) {
3349 3354 logger.error("", e);
... ... @@ -4336,7 +4341,8 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4336 4341 return new ArrayList<Map<String, Object>>();
4337 4342 }
4338 4343  
4339   - public void exportWaybill_pl(List<ScheduleRealInfo> listpl,String date,String jName, String clZbh,String lpName) {
  4344 + public void exportWaybill_pl(List<ScheduleRealInfo> listpl,
  4345 + String date, String jName, String clZbh, String lpName) {
4340 4346 ReportUtils ee = new ReportUtils();
4341 4347 ReportRelatedUtils rru = new ReportRelatedUtils();
4342 4348 List<Iterator<?>> list = new ArrayList<Iterator<?>>();
... ... @@ -4359,7 +4365,7 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4359 4365 // int cjbc = scheduleRealInfoRepository.findCjbc(jName, clZbh, lpName);
4360 4366 // int ljbc = scheduleRealInfoRepository.findLjbc(jName, clZbh, lpName);
4361 4367 //计算里程和班次数,并放入Map里
4362   - Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
  4368 + Map<String, Object> map = this.MapById(scheduleRealInfos.get(0).getId());
4363 4369  
4364 4370 map.put("jhlc",Arith.add(culateMieageService.culateJhgl(scheduleRealInfos),culateMieageService.culateJhJccgl(scheduleRealInfos)));
4365 4371 map.put("remMileage",culateMieageService.culateLbgl(scheduleRealInfos));
... ... @@ -4506,7 +4512,6 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4506 4512  
4507 4513  
4508 4514 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
4509   -
4510 4515 list.add(listMap.iterator());
4511 4516 String xls="";
4512 4517 if(map.get("type").toString().equals("0")){
... ... @@ -4514,15 +4519,16 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4514 4519 }else{
4515 4520 xls="waybill_minhang_dl.xls";
4516 4521 }
  4522 + map.put("sheetName", jName + "-" + clZbh + "-" + lpName);
4517 4523 ee.excelReplace(list, new Object[]{map}, path + "mould/"+xls,
4518 4524 path + "export/" + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
4519   -// return scheduleRealInfos;
4520 4525 }
4521 4526  
4522 4527 @Override
4523 4528 public Map<String, Object> exportWaybillMore(Map<String, Object> map) {
4524 4529 String date = map.get("date").toString();
4525 4530 String line = map.get("line").toString();
  4531 + ReportUtils ee = new ReportUtils();
4526 4532 List<List> lists = JSON.parseArray(map.get("strs").toString(), List.class);
4527 4533 String path = this.getClass().getResource("/").getPath() + "static/pages/forms/export/";
4528 4534 SimpleDateFormat sdfMonth = new SimpleDateFormat("yyyy-MM-dd"),
... ... @@ -4532,16 +4538,19 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4532 4538 try {
4533 4539 while (true) {
4534 4540 String fileUrl = path + "行车路单" + sdfSimple.format(sdfMonth.parse(date));
4535   - file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/"));
4536   - if (file.exists()) {
  4541 +// file = new File(fileUrl + (num == 0 ? "/" : "(" + num + ")/")); //新建文件夹
  4542 + file = new File(fileUrl + (num == 0 ? ".xls" : "(" + num + ").xls")); //新建excel文件
  4543 + if (file.exists()) { //判断是否已存在重名
4537 4544 num++;
4538 4545 } else {
4539 4546 break;
4540 4547 }
4541 4548 }
4542   - file.mkdirs();
  4549 +// file.mkdirs(); //创建
4543 4550 List<ScheduleRealInfo> lists_line=scheduleRealInfoRepository.scheduleByDateAndLineTjrb(line, date);
4544   - for (List<String> list : lists) {
  4551 +
  4552 + List<File> files = new ArrayList<File>();
  4553 + for (List<String> list : lists){
4545 4554 List<ScheduleRealInfo> newList=new ArrayList<ScheduleRealInfo>();
4546 4555 String jName = list.get(0);
4547 4556 String clZbh = list.get(1);
... ... @@ -4556,26 +4565,37 @@ public class ScheduleRealInfoServiceImpl extends BaseServiceImpl&lt;ScheduleRealInf
4556 4565 this.exportWaybill_pl(newList, date, jName, clZbh, lpName);
4557 4566 File temp = new File(path + date + "-" + jName + "-" + clZbh + "-" + lpName + "-行车路单.xls");
4558 4567 String fileName = file.getName();
4559   - temp.renameTo(new File(path + fileName + "/" + temp.getName()));
4560   -
4561   - File[] listFiles = file.listFiles();
4562   - ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip")));
4563   -// zos.setEncoding("gbk");
4564   -// zos.putNextEntry(new ZipEntry(fileName + "/"));
4565   - for (int i = 0; i < listFiles.length; i++) {
4566   - zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName()));
4567   - BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
4568   - BufferedOutputStream bos = new BufferedOutputStream(zos);
4569   - int bytesRead = 0;
4570   - for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) {
4571   -// zos.write(buffer, 0, bytesRead);
4572   -// zos.flush();
4573   - bos.write(buffer, 0, bytesRead);
4574   - bos.flush();
4575   - }
4576   - }
4577   - zos.close();
4578   - }
  4568 + files.add(temp);
  4569 + }
  4570 + for(int i = 1; i < files.size(); i++){
  4571 + File file1 = files.get(0);
  4572 + File file2 = files.get(i);
  4573 + ee.copySheetByFile(file2, file1, 0, 145);
  4574 + }
  4575 + File newFile = files.get(0);
  4576 + newFile.renameTo(file);
  4577 +
  4578 +// temp.renameTo(new File(path + fileName + "/" + temp.getName()));
  4579 +// File[] listFiles = file.listFiles();
  4580 +// ZipOutputStream zos = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(path + file.getName() + ".zip")));
  4581 +//// zos.setEncoding("gbk");
  4582 +//// zos.putNextEntry(new ZipEntry(fileName + "/"));
  4583 +// for (int i = 0; i < listFiles.length; i++) {
  4584 +// zos.putNextEntry(new ZipEntry(fileName + "/" + listFiles[i].getName()));
  4585 +// BufferedInputStream bis = new BufferedInputStream(new FileInputStream(listFiles[i]));
  4586 +// BufferedOutputStream bos = new BufferedOutputStream(zos);
  4587 +// int bytesRead = 0;
  4588 +// for (byte[] buffer = new byte[BUF_SIZE]; ((bytesRead = bis.read(buffer, 0, BUF_SIZE)) != -1); ) {
  4589 +//// zos.write(buffer, 0, bytesRead);
  4590 +//// zos.flush();
  4591 +// bos.write(buffer, 0, bytesRead);
  4592 +// bos.flush();
  4593 +// }
  4594 +//// bos.close();
  4595 +// bis.close();
  4596 +// }
  4597 +// zos.close();
  4598 +// }
4579 4599  
4580 4600 } catch (Exception e) {
4581 4601 // TODO: handle exception
... ...
src/main/java/com/bsth/service/report/ReportService.java
... ... @@ -46,8 +46,12 @@ public interface ReportService {
46 46 List<Map<String, String>> userList(Map<String, Object> map);
47 47  
48 48 List<Map<String, Object>> countByList(Map<String, Object> map);
  49 + List<Map<String, Object>> countByList2(Map<String, Object> map);
  50 +
49 51  
50 52 List<Map<String, Object>> countByBusList(Map<String, Object> map);
51 53  
52 54 List<Map<String, Object>> countDjg(Map<String, Object> map);
  55 +
  56 + Map<String, Object> online(Map<String, Object> map);
53 57 }
... ...
src/main/java/com/bsth/service/report/impl/CulateMileageServiceImpl.java
... ... @@ -1198,7 +1198,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1198 1198 Iterator<ChildTaskPlan> it = childTaskPlans.iterator();
1199 1199 while (it.hasNext()) {
1200 1200 ChildTaskPlan childTaskPlan = it.next();
1201   - if(item.equals("空放")){
  1201 +// if(item.equals("空放")){
1202 1202 /*if(childTaskPlan.getType2().equals("1")){
1203 1203 if (!childTaskPlan.isDestroy()) {
1204 1204 if(childTaskPlan.getReason().equals(item)){
... ... @@ -1206,7 +1206,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1206 1206 }
1207 1207 }
1208 1208 }*/
1209   - }else{
  1209 +// }else{
1210 1210 if(childTaskPlan.getType2().equals("2")||childTaskPlan.getType2().equals("3")){
1211 1211 if (!childTaskPlan.isDestroy()) {
1212 1212 if(childTaskPlan.getReason().equals(item)){
... ... @@ -1214,7 +1214,7 @@ public class CulateMileageServiceImpl implements CulateMileageService{
1214 1214 }
1215 1215 }
1216 1216 }
1217   - }
  1217 +// }
1218 1218 }
1219 1219 }
1220 1220 }
... ...
src/main/java/com/bsth/service/report/impl/ReportServiceImpl.java
... ... @@ -2546,6 +2546,111 @@ public class ReportServiceImpl implements ReportService{
2546 2546 }
2547 2547  
2548 2548  
  2549 + @Override
  2550 + public List<Map<String, Object>> countByList2(Map<String, Object> map) {
  2551 + // TODO Auto-generated method stub
  2552 +
  2553 + List<Map<String, Object>> lMap = new ArrayList<Map<String, Object>>();
  2554 + String gsdm="";
  2555 + if(map.get("gsdm")!=null){
  2556 + gsdm=map.get("gsdm").toString();
  2557 + }
  2558 + String fgsdm="";
  2559 + if(map.get("fgsdm")!=null){
  2560 + fgsdm=map.get("fgsdm").toString();
  2561 + }
  2562 + String line="";
  2563 + if(map.get("line")!=null){
  2564 + line=map.get("line").toString();
  2565 + }
  2566 + String date="";
  2567 + if(map.get("date")!=null){
  2568 + date=map.get("date").toString();
  2569 + }
  2570 + String date2="";
  2571 + if(map.get("date2")!=null){
  2572 + date2=map.get("date2").toString();
  2573 + }
  2574 + String xlName="";
  2575 + if(map.get("xlName")!=null){
  2576 + xlName=map.get("xlName").toString();
  2577 + }
  2578 + String type="";
  2579 + if(map.get("type")!=null){
  2580 + type=map.get("type").toString();
  2581 + }
  2582 + //所有班次信息
  2583 + List<ScheduleRealInfo> list = new ArrayList<ScheduleRealInfo>();
  2584 + line =line.trim();
  2585 + List<Line> lineList=lineRepository.findLineBygsBm(gsdm, fgsdm, "");
  2586 +// if(line.equals("")){
  2587 +// //查询所有线路
  2588 +// list = scheduleRealInfoRepository.scheduleByDateAndLineTj(line, date,date2,gsdm,fgsdm);
  2589 +// }else{
  2590 + //查询单条线路
  2591 +// list = scheduleRealInfoRepository.scheduleByDateAndLineTj2(line, date,date2);
  2592 +// }
  2593 +
  2594 +
  2595 + String sql="select r.xl_bm"
  2596 + + " from bsth_c_s_sp_info_real r where"
  2597 + + " r.schedule_date_str >= '"+date+"' and r.schedule_date_str >= '"+date2+"'";
  2598 +
  2599 +
  2600 + if(line.equals("")){
  2601 + sql +="and r.gs_bm='"+gsdm+"' "
  2602 + + " and r.fgs_bm='"+fgsdm+"'";
  2603 + }else{
  2604 + sql += " and r.xl_bm = '"+line+"'";
  2605 + }
  2606 + sql += " group by r.xl_bm";
  2607 +
  2608 + List<String> listLine=jdbcTemplate.query(sql, new RowMapper<String>() {
  2609 + @Override
  2610 + public String mapRow(ResultSet arg0, int arg1) throws SQLException {
  2611 + String ve = arg0.getString("xl_bm");
  2612 + return ve;
  2613 + }
  2614 + });
  2615 + for (int i = 0; i < listLine.size(); i++) {
  2616 + List<ScheduleRealInfo> lists =scheduleRealInfoRepository.scheduleByDateAndLineTj2(listLine.get(i), date,date2);
  2617 + list.addAll(lists);
  2618 + //计算线路的各项公里
  2619 + if(lists.size()>0){
  2620 + Map<String, Object> newMap=staticTj(lists,"z");
  2621 + lMap.add(newMap);
  2622 + }
  2623 + }
  2624 + if(list.size()>0){
  2625 + Map<String, Object> newMap=staticTj(list,"f");
  2626 + lMap.add(newMap);
  2627 + }
  2628 + if(type.equals("export")){
  2629 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  2630 + Map<String, Object> m = new HashMap<String, Object>();
  2631 + m.put("date", date);
  2632 + m.put("date1", date2);
  2633 + String by=map.get("by").toString();
  2634 + String xls="";
  2635 + if(by.equals("sj")){
  2636 + xls="countByLine.xls";
  2637 + }else{
  2638 + xls="countByLines.xls";
  2639 + }
  2640 + ReportUtils ee = new ReportUtils();
  2641 + try {
  2642 + listI.add(lMap.iterator());
  2643 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  2644 + ee.excelReplace(listI, new Object[]{m}, path + "mould/"+xls,
  2645 + path + "export/线路公里统计表.xls");
  2646 + } catch (Exception e) {
  2647 + // TODO: handle exception
  2648 + e.printStackTrace();
  2649 + }
  2650 + }
  2651 + return lMap;
  2652 + }
  2653 +
2549 2654 public final Map<String, Object> staticTj(List<ScheduleRealInfo> list,String status){
2550 2655  
2551 2656 List<ScheduleRealInfo> lists=new ArrayList<ScheduleRealInfo>();
... ... @@ -3343,6 +3448,121 @@ public class ReportServiceImpl implements ReportService{
3343 3448 map.put("djgxx", mapList);
3344 3449 return map;
3345 3450 }
  3451 +
  3452 +
  3453 + @Override
  3454 + public Map<String, Object> online(Map<String, Object> map) {
  3455 + String line =map.get("line").toString();
  3456 + String date =map.get("date").toString();
  3457 + String type =map.get("type").toString();
  3458 + DecimalFormat df = new DecimalFormat("#0.00");
  3459 + String sql="select cl_zbh from bsth_c_s_sp_info_real where "
  3460 + + " schedule_date_str ='"+date+"' and xl_bm='"+line+"' group by cl_zbh";
  3461 + List<String> list= jdbcTemplate.query(sql,
  3462 + new RowMapper<String>(){
  3463 + @Override
  3464 + public String mapRow(ResultSet rs, int rowNum) throws SQLException {
  3465 + String clzbh=rs.getString("cl_zbh");
  3466 + return clzbh;
  3467 + }
  3468 + });
  3469 + List<Line> lineList=lineRepository.findLineByCode(line);
  3470 + int qzpcs =0;
  3471 + for (int i = 0; i < lineList.size(); i++) {
  3472 + Line l=lineList.get(i);
  3473 + qzpcs = l.getWarrantCar()==null?0:l.getWarrantCar();
  3474 + }
  3475 +
  3476 + SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
  3477 + SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
  3478 + int zxcl=0;
  3479 + try {
  3480 + Long date1 = simpleDateFormat.parse(date+" 00:00:01").getTime();
  3481 + Long date2=simpleDateFormat.parse(date+" 23:59:59").getTime();
  3482 + Date dates=simpleDateFormat.parse(date+" 00:00:00");
  3483 + List<ArrivalInfo> lists=load_online(line,date1,date2,dates);
  3484 + for (int i = 0; i < list.size(); i++) {
  3485 + String nbbm=list.get(i);
  3486 + String sbbb=BasicData.deviceId2NbbmMap.inverse().get(nbbm);
  3487 + for (int j = 0; j < lists.size(); j++) {
  3488 + ArrivalInfo a=lists.get(i);
  3489 + if(a.getDeviceId().equals(sbbb)){
  3490 + zxcl ++;
  3491 + break;
  3492 + }
  3493 + }
  3494 +
  3495 + }
  3496 + } catch (ParseException e) {
  3497 + // TODO Auto-generated catch block
  3498 + e.printStackTrace();
  3499 + }
  3500 + map.put("xlName", BasicData.lineCode2NameMap.get(line));
  3501 + map.put("qzpcs", qzpcs);
  3502 + map.put("ccs", list.size());
  3503 + map.put("zxcl", zxcl);
  3504 + String zxl="0";
  3505 + if(list.size()>0){
  3506 + zxl = df.format(zxcl/list.size());
  3507 + }
  3508 + map.put("zxl", zxl+"%");
  3509 +
  3510 + if(type.equals("export")){
  3511 + List<Map<String, Object>> lMap=new ArrayList<Map<String,Object>>();
  3512 +
  3513 + List<Iterator<?>> listI = new ArrayList<Iterator<?>>();
  3514 + Map<String, Object> m = new HashMap<String, Object>();
  3515 + m.put("date", date);
  3516 + m.put("xlName", BasicData.lineCode2NameMap.get(line));
  3517 + m.put("qzpcs", qzpcs);
  3518 + m.put("ccs", list.size());
  3519 + m.put("zxcl", zxcl);
  3520 + m.put("zxl", zxl+"%");
  3521 + lMap.add(m);
  3522 + ReportUtils ee = new ReportUtils();
  3523 + try {
  3524 + listI.add(lMap.iterator());
  3525 + String path = this.getClass().getResource("/").getPath() + "static/pages/forms/";
  3526 + ee.excelReplace(listI, new Object[]{m}, path + "mould/onlinelist.xls",
  3527 + path + "export/车辆在线率统计.xls");
  3528 + } catch (Exception e) {
  3529 + // TODO: handle exception
  3530 + e.printStackTrace();
  3531 + }
  3532 + }
  3533 + return map;
  3534 + }
  3535 +
  3536 + public List<ArrivalInfo> load_online(String line,Long date1,Long date2,Date dates){
  3537 + List<ArrivalInfo> list = null;
  3538 + Calendar cal = Calendar.getInstance();
  3539 + cal.setTime(dates);
  3540 + //周数,表分区字段
  3541 + int weeks_year = cal.get(Calendar.WEEK_OF_YEAR);
  3542 +
  3543 + Connection conn = null;
  3544 + PreparedStatement ps = null;
  3545 + ResultSet rs = null;
  3546 +
  3547 + String sql = "select * from bsth_c_arrival_info where line_id=? AND weeks_year=? AND ts > ? AND ts <=? order by ts";
  3548 + try{
  3549 + conn = DBUtils_MS.getConnection();
  3550 + ps = conn.prepareStatement(sql);
  3551 + ps.setString(1,line);
  3552 + ps.setInt(2, weeks_year);
  3553 + ps.setLong(3, date1);
  3554 + ps.setLong(4, date2);
  3555 + rs = ps.executeQuery();
  3556 +
  3557 + list = resultSet2Set(rs);
  3558 + }catch(Exception e){
  3559 + logger.error("", e);
  3560 + }finally {
  3561 + DBUtils_MS.close(rs, ps, conn);
  3562 + }
  3563 + return list;
  3564 + }
  3565 +
3346 3566  
3347 3567 }
3348 3568  
... ...
src/main/java/com/bsth/service/schedule/impl/CarsServiceImpl.java
... ... @@ -89,6 +89,7 @@ public class CarsServiceImpl extends BServiceImpl&lt;Cars, Integer&gt; implements Cars
89 89 if (cars.getId() != null) {
90 90 param.put("id_ne", cars.getId());
91 91 }
  92 + param.put("scrapState_eq", false);
92 93 param.put("equipmentCode_eq", cars.getEquipmentCode());
93 94 if (!CollectionUtils.isEmpty(list(param))) {
94 95 throw new ScheduleException("设备编号重复");
... ...
src/main/java/com/bsth/util/ReportUtils.java
... ... @@ -18,6 +18,7 @@ import org.apache.poi.hssf.usermodel.HSSFSheet;
18 18 import org.apache.poi.hssf.usermodel.HSSFWorkbook;
19 19 import org.apache.poi.poifs.filesystem.POIFSFileSystem;
20 20 import org.apache.poi.ss.usermodel.Cell;
  21 +import org.apache.poi.ss.util.CellRangeAddress;
21 22  
22 23 import com.bsth.entity.Line;
23 24 import com.bsth.entity.realcontrol.ScheduleRealInfo;
... ... @@ -114,6 +115,145 @@ public class ReportUtils {
114 115 }
115 116 }
116 117  
  118 + /**
  119 + * 将file1中的一页sheet复制到file2中
  120 + *
  121 + * @param file1
  122 + * 原sheet所在的excel文件
  123 + * @param file2
  124 + * 目标excel文件
  125 + * @param page
  126 + * 原excel中要被复制的sheet的位置(从0开始)
  127 + * @param rate
  128 + * 调整复制后的缩放倍率(列如:145,则为缩放145%)
  129 + */
  130 + public void copySheetByFile(File file1, File file2, int page, int rate) {
  131 + try {
  132 + // 把源文件放入流中
  133 + POIFSFileSystem fs1 = new POIFSFileSystem(new FileInputStream(file1));
  134 + HSSFWorkbook wb1 = new HSSFWorkbook(fs1);
  135 + HSSFSheet sheet = wb1.getSheetAt(page);
  136 + POIFSFileSystem fs2 = new POIFSFileSystem(new FileInputStream(file2));
  137 + HSSFWorkbook wb2 = new HSSFWorkbook(fs2);
  138 + HSSFSheet createSheet = wb2.createSheet(sheet.getSheetName());
  139 + HSSFCellStyle createCellStyle = wb2.createCellStyle();
  140 + HSSFRow row;
  141 +
  142 + createSheet.setZoom(rate, 100);
  143 + for(int i = 0; i < sheet.getRow(0).getPhysicalNumberOfCells(); i++){
  144 + createSheet.setColumnWidth(i, sheet.getColumnWidth(i));
  145 + }
  146 +
  147 + List<CellRangeAddress> mergedRegions = sheet.getMergedRegions();
  148 + for(int l = 0; l < mergedRegions.size(); l++){
  149 + //复制源表中的合并单元格
  150 + createSheet.addMergedRegion(mergedRegions.get(l));
  151 + }
  152 + int firstRow = sheet.getFirstRowNum();
  153 + int lastRow = sheet.getLastRowNum();
  154 + for(int k = firstRow; k <= lastRow; k++){
  155 + // 创建新建excel Sheet的行
  156 + HSSFRow rowCreat = createSheet.createRow(k);
  157 + // 取得源有excel Sheet的行
  158 + row = sheet.getRow(k);
  159 +// rowCreat.setHeight(row.getHeight()); //设置行高
  160 + // 单元格式样
  161 + int firstCell = row.getFirstCellNum();
  162 + int lastCell = row.getLastCellNum();
  163 + for (int j = firstCell; j < lastCell; j++) {
  164 + // 自动适应列宽 貌似不起作用
  165 +// createSheet.autoSizeColumn(j);
  166 +// System.out.println(row.getCell(j));
  167 + rowCreat.createCell(j);
  168 + String strVal = "";
  169 + if (row.getCell(j)==null) {
  170 +
  171 + } else {
  172 + strVal = row.getCell(j).getStringCellValue();
  173 + rowCreat.getCell(j).setCellValue(strVal);
  174 + copyCellStyle(wb1, row.getCell(j).getCellStyle(), createCellStyle);
  175 + createCellStyle.setBorderTop((short)1);
  176 + createCellStyle.setBorderLeft((short)1);
  177 + createCellStyle.setBorderRight((short)1);
  178 + createCellStyle.setBorderBottom((short)1);
  179 + rowCreat.getCell(j).setCellStyle(createCellStyle);
  180 + }
  181 + }
  182 + }
  183 +
  184 +// int firstRowNum = createSheet.getFirstRowNum();
  185 +// int lastRowNum = createSheet.getLastRowNum();
  186 +// int test = 0;
  187 +// for(int k = firstRowNum; k <= lastRowNum; k++){
  188 +// HSSFRow createRow = createSheet.getRow(k);
  189 +// int firstCellNum = createRow.getFirstCellNum();
  190 +// int lastCellNum = createRow.getLastCellNum();
  191 +// for(int i = firstCellNum; i < lastCellNum; i++){
  192 +// HSSFCell cell = createRow.getCell(i);
  193 +// cell.getCellStyle().setBorderTop(HSSFCellStyle.BORDER_THIN);
  194 +// cell.getCellStyle().setBorderLeft(HSSFCellStyle.BORDER_THIN);
  195 +// cell.getCellStyle().setBorderRight(HSSFCellStyle.BORDER_THIN);
  196 +// cell.getCellStyle().setBorderBottom(HSSFCellStyle.BORDER_THIN);
  197 +// test ++;
  198 +// }
  199 +// }
  200 +// System.out.println("test = " + test);
  201 +
  202 + FileOutputStream fileOut = new FileOutputStream(file2);
  203 + wb2.write(fileOut);
  204 + fileOut.close();
  205 + wb2.close();
  206 + wb1.close();
  207 + fs2.close();
  208 + fs1.close();
  209 + file1.delete();
  210 +// // 创建目标文件夹
  211 +// createFolder(targetPath);
  212 + // 输出文件
  213 + } catch (Exception e) {
  214 + e.printStackTrace();
  215 + }
  216 + }
  217 +
  218 + public void test(File file){
  219 + POIFSFileSystem fs;
  220 + try {
  221 + fs = new POIFSFileSystem(new FileInputStream(file));
  222 + HSSFWorkbook wb = new HSSFWorkbook(fs);
  223 + for(int j = 0; j < wb.getNumberOfSheets(); j++){
  224 + HSSFSheet sheet = wb.getSheetAt(j);
  225 + int firstRowNum = sheet.getFirstRowNum();
  226 + int lastRowNum = sheet.getLastRowNum();
  227 + int test = 0;
  228 + for(int k = firstRowNum; k <= lastRowNum; k++){
  229 + HSSFRow createRow = sheet.getRow(k);
  230 + int firstCellNum = createRow.getFirstCellNum();
  231 + int lastCellNum = createRow.getLastCellNum();
  232 + for(int i = firstCellNum; i < lastCellNum; i++){
  233 + HSSFCell cell = createRow.getCell(i);
  234 + HSSFCellStyle cellStyle = wb.createCellStyle();
  235 +
  236 + cellStyle.setBorderTop(HSSFCellStyle.BORDER_THIN);
  237 + cellStyle.setBorderLeft(HSSFCellStyle.BORDER_THIN);
  238 + cellStyle.setBorderRight(HSSFCellStyle.BORDER_THIN);
  239 + cellStyle.setBorderBottom(HSSFCellStyle.BORDER_THIN);
  240 + cell.setCellStyle(cellStyle);
  241 + test ++;
  242 + }
  243 + }
  244 + System.out.println("test = " + test);
  245 +
  246 + FileOutputStream fileOut = new FileOutputStream(file);
  247 + wb.write(fileOut);
  248 + fileOut.close();
  249 + }
  250 + } catch (Exception e) {
  251 + // TODO Auto-generated catch block
  252 + e.printStackTrace();
  253 + }
  254 +
  255 + }
  256 +
117 257 public String getCellValue(HSSFCell cell) {
118 258 int cellType = 0;
119 259 String result = "";
... ...
src/main/resources/fatso/start.js
... ... @@ -16,7 +16,7 @@ var platform = process.platform;
16 16 var iswin = platform=='win32';
17 17 var sp = platform=='win32'?'\\':'/';
18 18 //不参与的目录
19   -var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil']
  19 +var excludes = ['scheduleApp', 'trafficManage', 'control', 'permission'+sp+'authorize_all', 'summary', 'history_sch' ,'report'+sp+'oil','base'+sp+'geo_data_edit']
20 20 ,ep = new EventProxy()
21 21 ,pName = 'bsth_control'
22 22 ,path = process.cwd()
... ...
src/main/resources/logback.xml
... ... @@ -250,6 +250,29 @@
250 250 <!--<appender-ref ref="STDOUT" />-->
251 251 <!--</logger>-->
252 252  
  253 + <!-- 实际排班数据库更新日志 -->
  254 + <!-- 消息队列纪录 -->
  255 + <appender name="REAL_SCHEDULE_UPDATE"
  256 + class="ch.qos.logback.core.rolling.RollingFileAppender">
  257 + <file>${LOG_BASE}/real_sch_db/update.log</file>
  258 + <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
  259 + <fileNamePattern>${LOG_BASE}/real_sch_db/update-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
  260 + <timeBasedFileNamingAndTriggeringPolicy
  261 + class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
  262 + <maxFileSize>100MB</maxFileSize>
  263 + </timeBasedFileNamingAndTriggeringPolicy>
  264 + </rollingPolicy>
  265 +
  266 + <layout class="ch.qos.logback.classic.PatternLayout">
  267 + <pattern>%d{MM-dd HH:mm:ss.SSS} %-5level -%msg%n
  268 + </pattern>
  269 + </layout>
  270 + </appender>
  271 + <logger name="com.bsth.data.schedule.thread.SchedulePstThread"
  272 + level="INFO" additivity="false">
  273 + <appender-ref ref="REAL_SCHEDULE_UPDATE" />
  274 + </logger>
  275 +
253 276 <!--JdbcTemplate的日志输出器 -->
254 277 <logger name="org.springframework.jdbc.core.StatementCreatorUtils"
255 278 additivity="false" level="INFO">
... ...
src/main/resources/static/assets/js/TransGPS.js
... ... @@ -80,7 +80,7 @@ var TransGPS = (function(){
80 80 }
81 81  
82 82 function bd_decrypt(lat, lng){
83   - var x = bdLoc.lng - 0.0065, y = bdLoc.lat - 0.006;
  83 + var x = lng - 0.0065, y = lat - 0.006;
84 84 var z = Math.sqrt(x * x + y * y) - 0.00002 * Math.sin(y * x_pi);
85 85 var theta = Math.atan2(y, x) - 0.000003 * Math.cos(x * x_pi);
86 86  
... ... @@ -92,8 +92,12 @@ var TransGPS = (function(){
92 92 var gcj = transformFromWGSToGCJ(lat, lng);
93 93 return bd_encrypt(gcj.lat, gcj.lng);
94 94 },
95   - transformFromWGSToGCJ: transformFromWGSToGCJ
96   - }
  95 + transformFromWGSToGCJ: transformFromWGSToGCJ,
  96 + bdToWgs: function (lat, lng) {
  97 + var gcj = bd_decrypt(lat, lng);
  98 + return transformFromGCJToWGS(gcj.lat, gcj.lng);
  99 + }
  100 + };
97 101  
98 102 return transGPS;
99 103 })();
100 104 \ No newline at end of file
... ...
src/main/resources/static/assets/js/baidu/bd_GeoUtils_min.js 0 → 100644
  1 +var BMapLib=window.BMapLib=BMapLib||{};(function(){var a=6370996.81;var b=BMapLib.GeoUtils=function(){};b.isPointInRect=function(f,g){if(!(f instanceof BMap.Point)||!(g instanceof BMap.Bounds)){return false}var e=g.getSouthWest();var h=g.getNorthEast();return(f.lng>=e.lng&&f.lng<=h.lng&&f.lat>=e.lat&&f.lat<=h.lat)};b.isPointInCircle=function(e,h){if(!(e instanceof BMap.Point)||!(h instanceof BMap.Circle)){return false}var i=h.getCenter();var g=h.getRadius();var f=b.getDistance(e,i);if(f<=g){return true}else{return false}};b.isPointOnPolyline=function(f,h){if(!(f instanceof BMap.Point)||!(h instanceof BMap.Polyline)){return false}var e=h.getBounds();if(!this.isPointInRect(f,e)){return false}var m=h.getPath();for(var k=0;k<m.length-1;k++){var l=m[k];var j=m[k+1];if(f.lng>=Math.min(l.lng,j.lng)&&f.lng<=Math.max(l.lng,j.lng)&&f.lat>=Math.min(l.lat,j.lat)&&f.lat<=Math.max(l.lat,j.lat)){var g=(l.lng-f.lng)*(j.lat-f.lat)-(j.lng-f.lng)*(l.lat-f.lat);if(g<2e-10&&g>-2e-10){return true}}}return false};b.isPointInPolygon=function(o,l){if(!(o instanceof BMap.Point)||!(l instanceof BMap.Polygon)){return false}var k=l.getBounds();if(!this.isPointInRect(o,k)){return false}var t=l.getPath();var h=t.length;var n=true;var j=0;var g=2e-10;var s,q;var e=o;s=t[0];for(var f=1;f<=h;++f){if(e.equals(s)){return n}q=t[f%h];if(e.lat<Math.min(s.lat,q.lat)||e.lat>Math.max(s.lat,q.lat)){s=q;continue}if(e.lat>Math.min(s.lat,q.lat)&&e.lat<Math.max(s.lat,q.lat)){if(e.lng<=Math.max(s.lng,q.lng)){if(s.lat==q.lat&&e.lng>=Math.min(s.lng,q.lng)){return n}if(s.lng==q.lng){if(s.lng==e.lng){return n}else{++j}}else{var r=(e.lat-s.lat)*(q.lng-s.lng)/(q.lat-s.lat)+s.lng;if(Math.abs(e.lng-r)<g){return n}if(e.lng<r){++j}}}}else{if(e.lat==q.lat&&e.lng<=q.lng){var m=t[(f+1)%h];if(e.lat>=Math.min(s.lat,m.lat)&&e.lat<=Math.max(s.lat,m.lat)){++j}else{j+=2}}}s=q}if(j%2==0){return false}else{return true}};b.degreeToRad=function(e){return Math.PI*e/180};b.radToDegree=function(e){return(180*e)/Math.PI};function d(g,f,e){if(f!=null){g=Math.max(g,f)}if(e!=null){g=Math.min(g,e)}return g}function c(g,f,e){while(g>e){g-=e-f}while(g<f){g+=e-f}return g}b.getDistance=function(j,h){if(!(j instanceof BMap.Point)||!(h instanceof BMap.Point)){return 0}j.lng=c(j.lng,-180,180);j.lat=d(j.lat,-74,74);h.lng=c(h.lng,-180,180);h.lat=d(h.lat,-74,74);var f,e,i,g;f=b.degreeToRad(j.lng);i=b.degreeToRad(j.lat);e=b.degreeToRad(h.lng);g=b.degreeToRad(h.lat);return a*Math.acos((Math.sin(i)*Math.sin(g)+Math.cos(i)*Math.cos(g)*Math.cos(e-f)))};b.getPolylineDistance=function(f){if(f instanceof BMap.Polyline||f instanceof Array){var l;if(f instanceof BMap.Polyline){l=f.getPath()}else{l=f}if(l.length<2){return 0}var j=0;for(var h=0;h<l.length-1;h++){var k=l[h];var g=l[h+1];var e=b.getDistance(k,g);j+=e}return j}else{return 0}};b.getPolygonArea=function(t){if(!(t instanceof BMap.Polygon)&&!(t instanceof Array)){return 0}var R;if(t instanceof BMap.Polygon){R=t.getPath()}else{R=t}if(R.length<3){return 0}var w=0;var D=0;var C=0;var L=0;var J=0;var F=0;var E=0;var S=0;var H=0;var p=0;var T=0;var I=0;var q=0;var e=0;var M=0;var v=0;var K=0;var N=0;var s=0;var O=0;var l=0;var g=0;var z=0;var Q=0;var G=0;var j=0;var A=0;var o=0;var m=0;var y=0;var x=0;var h=0;var k=0;var f=0;var n=a;var B=R.length;for(var P=0;P<B;P++){if(P==0){D=R[B-1].lng*Math.PI/180;C=R[B-1].lat*Math.PI/180;L=R[0].lng*Math.PI/180;J=R[0].lat*Math.PI/180;F=R[1].lng*Math.PI/180;E=R[1].lat*Math.PI/180}else{if(P==B-1){D=R[B-2].lng*Math.PI/180;C=R[B-2].lat*Math.PI/180;L=R[B-1].lng*Math.PI/180;J=R[B-1].lat*Math.PI/180;F=R[0].lng*Math.PI/180;E=R[0].lat*Math.PI/180}else{D=R[P-1].lng*Math.PI/180;C=R[P-1].lat*Math.PI/180;L=R[P].lng*Math.PI/180;J=R[P].lat*Math.PI/180;F=R[P+1].lng*Math.PI/180;E=R[P+1].lat*Math.PI/180}}S=Math.cos(J)*Math.cos(L);H=Math.cos(J)*Math.sin(L);p=Math.sin(J);T=Math.cos(C)*Math.cos(D);I=Math.cos(C)*Math.sin(D);q=Math.sin(C);e=Math.cos(E)*Math.cos(F);M=Math.cos(E)*Math.sin(F);v=Math.sin(E);K=(S*S+H*H+p*p)/(S*T+H*I+p*q);N=(S*S+H*H+p*p)/(S*e+H*M+p*v);s=K*T-S;O=K*I-H;l=K*q-p;g=N*e-S;z=N*M-H;Q=N*v-p;m=(g*s+z*O+Q*l)/(Math.sqrt(g*g+z*z+Q*Q)*Math.sqrt(s*s+O*O+l*l));m=Math.acos(m);G=z*l-Q*O;j=0-(g*l-Q*s);A=g*O-z*s;if(S!=0){o=G/S}else{if(H!=0){o=j/H}else{o=A/p}}if(o>0){y+=m;k++}else{x+=m;h++}}var u,r;u=y+(2*Math.PI*h-x);r=(2*Math.PI*k-y)+x;if(y>x){if((u-(B-2)*Math.PI)<1){f=u}else{f=r}}else{if((r-(B-2)*Math.PI)<1){f=r}else{f=u}}w=(f-(B-2)*Math.PI)*n*n;return w}})();
0 2 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/css/mian.css 0 → 100644
  1 +<<<<<<< HEAD
  2 +/* ^_^ baidu map hide logo */
  3 +.anchorBL, .anchorBL, .amap-logo, .amap-copyright {
  4 + display: none;
  5 +}
  6 +
  7 +html,body{
  8 + height: 100%;
  9 +}
  10 +.ct_page{
  11 + padding: 0;
  12 + height: 100%;
  13 +}
  14 +
  15 +div#map_wrap{
  16 + height: 100%;
  17 +}
  18 +
  19 +.main_left_panel{
  20 + position: absolute;
  21 + z-index: 999;
  22 + height: calc(100% - 20px);
  23 + width: 300px;
  24 + background: #fffffff5;
  25 + top: 7px;
  26 + left: 5px;
  27 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  28 +}
  29 +.main_lt_search_panel{
  30 + position: absolute;
  31 + z-index: 99;
  32 + top: 10px;
  33 + left: 330px;
  34 + background: #fffffff5;
  35 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  36 +}
  37 +.main_rt_tools_panel{
  38 + position: absolute;
  39 + z-index: 99;
  40 + top: 7px;
  41 + right: 7px;
  42 + background: #ffffff;
  43 + box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48);
  44 + padding: 0 12px;
  45 + text-align: center;
  46 + border-radius: 7px;
  47 + height: 28px;
  48 +}
  49 +
  50 +.main_rt_tools_panel>._icon{
  51 + margin: 0 9px;
  52 +}
  53 +.search_input{
  54 + width: 250px;
  55 + height: 42px;
  56 +}
  57 +
  58 +.search_input::placeholder{
  59 + color: grey;
  60 + font-size: 12px;
  61 +}
  62 +
  63 +._line_info{
  64 + width: 100%;
  65 + height: 90px;
  66 + background: white;
  67 + box-shadow: 0px -2px 15px rgba(90, 90, 90, 0.48);
  68 +}
  69 +
  70 +._line_name{
  71 + padding: 10px 0 0 15px;
  72 + font-weight: 600;
  73 + font-family: 微软雅黑;
  74 + font-size: 18px;
  75 + color: #484848;
  76 + position: relative;
  77 +}
  78 +
  79 +._version_dropdown_wrap{
  80 + padding: 4px 0 0 15px;
  81 +}
  82 +._version_text{
  83 + font-size: 14px;
  84 + color: #0aae0a;
  85 +}
  86 +._version_dropdown_wrap li.uk-active>a{
  87 + color: #0aae0a;
  88 +}
  89 +.uk-nav-header:not(:first-child) {
  90 + margin-top: 10px;
  91 +}
  92 +.add_line_version_icon{
  93 + position: absolute;
  94 + right: 18px;
  95 + top: 10px;
  96 +}
  97 +.clock_enable_version{
  98 + padding: 4px 0 0 15px;
  99 + font-size: 13px;
  100 + color: #ef4f4f;
  101 +}
  102 +
  103 +.clock_enable_version>a.uk-icon{
  104 + vertical-align: top;
  105 + margin-top: 6px;
  106 +}
  107 +._route_info_wrap{
  108 + height: calc(100% - 100px);
  109 + padding-top: 10px;
  110 +}
  111 +
  112 +._route_info_wrap .uk-tab>li>a{
  113 + padding: 9px 5px;
  114 +}
  115 +._route_info_wrap>ul.uk-tab{
  116 + padding-left: 10px;
  117 + margin-bottom: 0;
  118 +}
  119 +.rt_show_version_txt{
  120 + position: absolute;
  121 + right: 7px;
  122 + bottom: 7px;
  123 + font-size: 12px;
  124 +}
  125 +.rt_show_version_txt{
  126 + position: absolute;
  127 + right: 7px;
  128 + bottom: 7px;
  129 + font-size: 12px;
  130 + padding: 5px 8px;
  131 +}
  132 +.station_route>ul{
  133 + padding: 0 0 0 30px;
  134 + font-size: 14px;
  135 + width: calc(100% - 38px);
  136 +}
  137 +
  138 +.up_down_route_list ul.uk-list>li:nth-child(n+2), .uk-list>li>ul {
  139 + margin-top: 0;
  140 +}
  141 +
  142 +.station_route>ul>li>a{
  143 + color: #434343;
  144 + overflow: hidden;
  145 + text-overflow: ellipsis;
  146 + white-space: nowrap;
  147 + display: inline-block;
  148 + width: calc(100% - 53px);
  149 + padding: 4px 0;
  150 + vertical-align: middle;+0982/
  151 +}
  152 +
  153 +.ct_route_badge{
  154 + font-size: 11px;
  155 + height: 18px;
  156 + border-radius: 5px;
  157 + vertical-align: top;
  158 + margin-top: 1px;
  159 + padding: 0 4px;
  160 + margin-right: 3px;
  161 + min-width: 18px;
  162 +}
  163 +
  164 +.up_down_route_list>li:nth-of-type(2) .ct_route_badge{
  165 + background: #fb6464;
  166 +}
  167 +
  168 +.ct_route_badge.start{
  169 + margin-left: 0px;
  170 +}
  171 +.ct_route_badge.end{
  172 + margin-left: 0px;
  173 +}
  174 +.road_route{
  175 + padding-left: 30px;
  176 + width: calc(100% - 25px);
  177 + font-size: 14px;
  178 + color: #242424;
  179 + border-top: 1px solid #d5d5d5;
  180 + padding-top: 0;
  181 +}
  182 +._route_info_wrap>ul.uk-switcher{
  183 + overflow: auto;
  184 + height: calc(100% - 62px);
  185 + margin-bottom: 0;
  186 + position: relative;
  187 + padding-top: 20px;
  188 + margin-top: 0 !important;
  189 +}
  190 +
  191 +.pos_tb_icon{
  192 + position: absolute;
  193 + bottom: 15px;
  194 + right: 15px;
  195 +}
  196 +.ct_route_badge_wrap{
  197 + display: inline-block;
  198 + width: 48px;
  199 + text-align: right;
  200 + vertical-align: top;
  201 + margin-top: 3px;
  202 +}
  203 +
  204 +.road_route>ul li a{
  205 + color: #242424;
  206 + width: 100%;
  207 + display: block;
  208 + padding-left: 8px;
  209 +}
  210 +
  211 +.road_route>ul{
  212 + border-left: 1px solid #cbcbcb;
  213 + padding-left: 0;
  214 + padding-top: 10px;
  215 +}
  216 +
  217 +span.sub_name {
  218 + font-size: 12px;
  219 + color: #777676;
  220 + margin-left: 5px;
  221 +}
  222 +
  223 +.road_route>ul>li{
  224 + width: calc(100% - 10px);
  225 + overflow: hidden;
  226 + text-overflow: ellipsis;
  227 + white-space: nowrap;
  228 + display: inline-block;
  229 +}
  230 +
  231 +#map_wrap img {
  232 + max-width: none;
  233 +}
  234 +
  235 +ul.uk-list.station_info_win {
  236 + font-size: 14px;
  237 + padding-left: 5px;
  238 +}
  239 +
  240 +.uk-list.station_info_win>li:nth-child(n+2), .uk-list.station_info_win>li>ul {
  241 + margin-top: 7px;
  242 +}
  243 +
  244 +ul.uk-list.station_info_win>li.s_name{
  245 + font-size: 16px;
  246 + font-weight: 600;
  247 + color: #e15428;
  248 +}
  249 +
  250 +.up_down_route_list li.ct_active{
  251 + background: #91d9fa;
  252 +}
  253 +
  254 +.up_down_route_list li.ct_active.first_road_active{
  255 + background: #fff;
  256 +}
  257 +
  258 +.up_down_route_list li.ct_active.first_road_active>a{
  259 + background: #91d9fa;
  260 +}
  261 +
  262 +.road_route .uk-list ul{
  263 + padding-left: 22px;
  264 +}
  265 +
  266 +.road_route>ul>li>ul>li{
  267 + padding-left: 8px;
  268 +}
  269 +
  270 +.ct_coord_str{
  271 + max-height: 300px;
  272 + overflow: auto;
  273 +}
  274 +
  275 +ul.context-menu-list.station-route-ct-menu.context-menu-root {
  276 + font-size: 14px;
  277 + width: 170px !important;
  278 + min-width: 70px;
  279 + border: 1px solid #d2d2d2;
  280 + overflow: hidden;
  281 + border-radius: 0;
  282 + background: #fff;
  283 + color: #666;
  284 + box-shadow: 0 5px 12px rgba(0,0,0,.15);
  285 +}
  286 +
  287 +.main_left_panel_m_layer{
  288 + position: absolute;
  289 + z-index: 10000;
  290 + height: calc(100% - 20px);
  291 + width: 300px;
  292 + background: #ffffff85;
  293 + top: 7px;
  294 + left: 5px;
  295 + display: none;
  296 +}
  297 +
  298 +.buffer_edit_panel{
  299 + position: absolute;
  300 + top: 5px;
  301 + width: 390px;
  302 + height: 120px;
  303 + background: #ffffff;
  304 + left: calc(50% - 170px);
  305 + z-index: 999;
  306 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  307 + display: none;
  308 +}
  309 +.buffer_edit_body{
  310 + padding: 5px 0 0 15px;
  311 +}
  312 +
  313 +.buffer_edit_body>.name{
  314 + font-weight: 600;
  315 + color: #E91E63;
  316 + margin-bottom: 0;
  317 +}
  318 +
  319 +.buffer_edit_body .ct_row .uk-inline{
  320 + width: 175px;
  321 + height: 30px;
  322 + margin-right: 7px;
  323 +}
  324 +
  325 +.buffer_edit_body .ct_row{
  326 + margin-top: 12px;
  327 +}
  328 +
  329 +.buffer_edit_body .ct_row .uk-inline:last-child{
  330 + margin-right: 0;
  331 +}
  332 +
  333 +.buffer_edit_body .ct_row .uk-inline input{
  334 + height: 30px;
  335 +}
  336 +
  337 +.buffer_edit_body .ct_row .uk-form-icon-flip {
  338 + font-size: 12px;
  339 +}
  340 +
  341 +.buffer_edit_body .ct_row .uk-inline.btns{
  342 + text-align: right;
  343 +}
  344 +.buffer_edit_body .ct_row .uk-inline.btns .uk-button{
  345 + padding: 0 15px;
  346 + height: 28px;
  347 + line-height: 28px;
  348 + vertical-align: top;
  349 + margin-top: 2px;
  350 +}
  351 +
  352 +.loading{
  353 + height: 100%;
  354 + text-align: center;
  355 + position: absolute;
  356 + z-index: 10000;
  357 + top: 0;
  358 + left: 0;
  359 + width: 100%;
  360 + background: #ffffff78;
  361 + display: flex;
  362 +}
  363 +
  364 +.loading>div{
  365 + margin: auto;
  366 + margin-top: calc(25% - 100px);
  367 + background: #f9d56c;
  368 + padding: 12px;
  369 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  370 +}
  371 +
  372 +.loading>div>span{
  373 + vertical-align: top;
  374 + margin-top: -6px;
  375 + margin-right: 5px;
  376 + font-size: 14px;
  377 +}
  378 +.uk-modal{
  379 + z-index: 10001;
  380 +}
  381 +
  382 +.ct_route_badge.polygon{
  383 +
  384 +}
  385 +
  386 +.shapes_type>div.uk-inline:nth-of-type(2){
  387 + width: 80px;
  388 + margin-right: 0;
  389 +}
  390 +
  391 +.shapes_type>div.uk-inline:first-child{
  392 + width: 84px;
  393 +}
  394 +
  395 +.shapes_type>div.uk-inline:first-child select{
  396 + height: 30px;
  397 +}
  398 +
  399 +.shapes_type.st_d>div.uk-inline:nth-of-type(2){
  400 + display: none;
  401 +}
  402 +
  403 +.shapes_type.st_d>div.uk-inline:first-child{
  404 + width: 167px;
  405 +}
  406 +
  407 +.draw_polygon_switch{
  408 + display: none;
  409 +}
  410 +
  411 +.shapes_type.st_d>div.uk-inline:first-child select{
  412 + width: 107px;
  413 +}
  414 +
  415 +.shapes_type.st_d .draw_polygon_switch{
  416 + display: inline-block;
  417 + font-size: 12px;
  418 + vertical-align: bottom;
  419 + margin-left: 5px;
  420 +}
  421 +
  422 +.shapes_type.st_d .draw_polygon_switch>a{
  423 + color: red;
  424 +}
  425 +
  426 +.ul_li_input{
  427 + display: inline-block;
  428 + padding: 4px 0;
  429 + width: calc(100% - 53px);
  430 + background: #f7f7f7;
  431 +}
  432 +
  433 +.ul_li_input input{
  434 + width: 140px;
  435 + height: 28px;
  436 + margin-left: 5px;
  437 +}
  438 +
  439 +.save_icon_btn{
  440 + color: #2121d1;
  441 + margin-right: 4px;
  442 +}
  443 +
  444 +.ul_li_input .uk-icon:hover{
  445 + background: #dfdfdf;
  446 +}
  447 +
  448 +.station_li_transient .ct_route_badge{
  449 + background: #ddcd3f;
  450 + vertical-align: middle;
  451 +}
  452 +
  453 +.station_li_transient .search_point_icon_btn{
  454 + color: #FF9800;
  455 + margin-right: 5px;
  456 +}
  457 +
  458 +.station_route ._edit_name .ct_route_badge{
  459 + vertical-align: middle;
  460 +}
  461 +
  462 +.add_station_search_point_wrap{
  463 + width: 390px;
  464 + height: 140px;
  465 + position: absolute;
  466 + top: 10px;
  467 + left: calc(50% - 200px);
  468 + z-index: 999;
  469 + background: #ffface;
  470 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  471 +}
  472 +
  473 +.add_station_search_point_wrap ._title {
  474 + text-align: center;
  475 + font-size: 17px;
  476 + color: #2b2b2b;
  477 + padding: 2px 0 0 0;
  478 + font-weight: 600;
  479 +}
  480 +
  481 +.add_station_search_point_wrap .buffer_edit_body .ct_row {
  482 + margin-top: 8px;
  483 +=======
  484 +/* ^_^ baidu map hide logo */
  485 +.anchorBL, .anchorBL, .amap-logo, .amap-copyright {
  486 + display: none;
  487 +}
  488 +
  489 +html,body{
  490 + height: 100%;
  491 +}
  492 +.ct_page{
  493 + padding: 0;
  494 + height: 100%;
  495 +}
  496 +
  497 +div#map_wrap{
  498 + height: 100%;
  499 +}
  500 +
  501 +.main_left_panel{
  502 + position: absolute;
  503 + z-index: 999;
  504 + height: calc(100% - 20px);
  505 + width: 300px;
  506 + background: #fffffff5;
  507 + top: 7px;
  508 + left: 5px;
  509 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  510 +}
  511 +.main_lt_search_panel{
  512 + position: absolute;
  513 + z-index: 99;
  514 + top: 10px;
  515 + left: 330px;
  516 + background: #fffffff5;
  517 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  518 +}
  519 +.main_rt_tools_panel{
  520 + position: absolute;
  521 + z-index: 99;
  522 + top: 7px;
  523 + right: 7px;
  524 + background: #ffffff;
  525 + box-shadow: -5px 4px 15px rgba(90, 90, 90, 0.48);
  526 + padding: 0 12px;
  527 + text-align: center;
  528 + border-radius: 7px;
  529 + height: 28px;
  530 +}
  531 +
  532 +.main_rt_tools_panel>._icon{
  533 + margin: 0 9px;
  534 +}
  535 +.search_input{
  536 + width: 250px;
  537 + height: 42px;
  538 +}
  539 +
  540 +.search_input::placeholder{
  541 + color: grey;
  542 + font-size: 12px;
  543 +}
  544 +
  545 +._line_info{
  546 + width: 100%;
  547 + height: 90px;
  548 + background: white;
  549 + box-shadow: 0px -2px 15px rgba(90, 90, 90, 0.48);
  550 +}
  551 +
  552 +._line_name{
  553 + padding: 10px 0 0 15px;
  554 + font-weight: 600;
  555 + font-family: 微软雅黑;
  556 + font-size: 18px;
  557 + color: #484848;
  558 + position: relative;
  559 +}
  560 +
  561 +._version_dropdown_wrap{
  562 + padding: 4px 0 0 15px;
  563 +}
  564 +._version_text{
  565 + font-size: 14px;
  566 + color: #0aae0a;
  567 +}
  568 +._version_dropdown_wrap li.uk-active>a{
  569 + color: #0aae0a;
  570 +}
  571 +.uk-nav-header:not(:first-child) {
  572 + margin-top: 10px;
  573 +}
  574 +.add_line_version_icon{
  575 + position: absolute;
  576 + right: 18px;
  577 + top: 10px;
  578 +}
  579 +.clock_enable_version{
  580 + padding: 4px 0 0 15px;
  581 + font-size: 13px;
  582 + color: #ef4f4f;
  583 +}
  584 +
  585 +.clock_enable_version>a.uk-icon{
  586 + vertical-align: top;
  587 + margin-top: 6px;
  588 +}
  589 +._route_info_wrap{
  590 + height: calc(100% - 100px);
  591 + padding-top: 10px;
  592 +}
  593 +
  594 +._route_info_wrap .uk-tab>li>a{
  595 + padding: 9px 5px;
  596 +}
  597 +._route_info_wrap>ul.uk-tab{
  598 + padding-left: 10px;
  599 + margin-bottom: 0;
  600 +}
  601 +.rt_show_version_txt{
  602 + position: absolute;
  603 + right: 7px;
  604 + bottom: 7px;
  605 + font-size: 12px;
  606 +}
  607 +.rt_show_version_txt{
  608 + position: absolute;
  609 + right: 7px;
  610 + bottom: 7px;
  611 + font-size: 12px;
  612 + padding: 5px 8px;
  613 +}
  614 +.station_route>ul{
  615 + padding: 0 0 0 30px;
  616 + font-size: 14px;
  617 + width: calc(100% - 38px);
  618 +}
  619 +
  620 +.station_route>ul.uk-list>li:nth-child(n+2), .uk-list>li>ul {
  621 + margin-top: 0;
  622 +}
  623 +
  624 +.station_route>ul>li>a{
  625 + color: #434343;
  626 + overflow: hidden;
  627 + text-overflow: ellipsis;
  628 + white-space: nowrap;
  629 + display: inline-block;
  630 + width: calc(100% - 53px);
  631 + padding: 4px 0;
  632 + vertical-align: middle;+0982/
  633 +}
  634 +
  635 +.ct_route_badge{
  636 + font-size: 11px;
  637 + height: 18px;
  638 + border-radius: 5px;
  639 + vertical-align: top;
  640 + margin-top: 1px;
  641 + padding: 0 4px;
  642 + margin-right: 3px;
  643 + min-width: 18px;
  644 +}
  645 +
  646 +.up_down_route_list>li:nth-of-type(2) .ct_route_badge{
  647 + background: #fb6464;
  648 +}
  649 +
  650 +.ct_route_badge.start{
  651 + margin-left: 0px;
  652 +}
  653 +.ct_route_badge.end{
  654 + margin-left: 0px;
  655 +}
  656 +.road_route{
  657 + padding-left: 30px;
  658 + width: calc(100% - 25px);
  659 + font-size: 14px;
  660 + color: #242424;
  661 + border-top: 1px solid #d5d5d5;
  662 + padding-top: 0;
  663 +}
  664 +._route_info_wrap>ul.uk-switcher{
  665 + overflow: auto;
  666 + height: calc(100% - 62px);
  667 + margin-bottom: 0;
  668 + position: relative;
  669 + padding-top: 20px;
  670 + margin-top: 0 !important;
  671 +}
  672 +
  673 +.pos_tb_icon{
  674 + position: absolute;
  675 + bottom: 15px;
  676 + right: 15px;
  677 +}
  678 +.ct_route_badge_wrap{
  679 + display: inline-block;
  680 + width: 48px;
  681 + text-align: right;
  682 + vertical-align: top;
  683 + margin-top: 3px;
  684 +}
  685 +
  686 +.road_route>ul li a{
  687 + color: #242424;
  688 + width: 100%;
  689 + display: block;
  690 + padding-left: 8px;
  691 +}
  692 +
  693 +.road_route>ul{
  694 + border-left: 1px solid #cbcbcb;
  695 + padding-left: 0;
  696 + padding-top: 10px;
  697 +}
  698 +
  699 +span.sub_name {
  700 + font-size: 12px;
  701 + color: #777676;
  702 + margin-left: 5px;
  703 +}
  704 +
  705 +.road_route>ul>li{
  706 + width: calc(100% - 10px);
  707 + overflow: hidden;
  708 + text-overflow: ellipsis;
  709 + white-space: nowrap;
  710 + display: inline-block;
  711 +}
  712 +
  713 +#map_wrap img {
  714 + max-width: none;
  715 +}
  716 +
  717 +ul.uk-list.station_info_win {
  718 + font-size: 14px;
  719 + padding-left: 5px;
  720 +}
  721 +
  722 +.uk-list.station_info_win>li:nth-child(n+2), .uk-list.station_info_win>li>ul {
  723 + margin-top: 7px;
  724 +}
  725 +
  726 +ul.uk-list.station_info_win>li.s_name{
  727 + font-size: 16px;
  728 + font-weight: 600;
  729 + color: #e15428;
  730 +}
  731 +
  732 +.up_down_route_list li.ct_active{
  733 + background: #91d9fa;
  734 +}
  735 +
  736 +.up_down_route_list li.ct_active.first_road_active{
  737 + background: #fff;
  738 +}
  739 +
  740 +.up_down_route_list li.ct_active.first_road_active>a{
  741 + background: #91d9fa;
  742 +}
  743 +
  744 +.road_route .uk-list ul{
  745 + padding-left: 22px;
  746 +}
  747 +
  748 +.road_route>ul>li>ul>li{
  749 + padding-left: 8px;
  750 +}
  751 +
  752 +.ct_coord_str{
  753 + max-height: 300px;
  754 + overflow: auto;
  755 +}
  756 +
  757 +ul.context-menu-list.station-route-ct-menu.context-menu-root {
  758 + font-size: 14px;
  759 + width: 170px !important;
  760 + min-width: 70px;
  761 + border: 1px solid #d2d2d2;
  762 + overflow: hidden;
  763 + border-radius: 0;
  764 + background: #fff;
  765 + color: #666;
  766 + box-shadow: 0 5px 12px rgba(0,0,0,.15);
  767 +}
  768 +
  769 +.main_left_panel_m_layer{
  770 + position: absolute;
  771 + z-index: 10000;
  772 + height: calc(100% - 20px);
  773 + width: 300px;
  774 + background: #ffffff85;
  775 + top: 7px;
  776 + left: 5px;
  777 + display: none;
  778 +}
  779 +
  780 +.buffer_edit_panel{
  781 + position: absolute;
  782 + top: 5px;
  783 + width: 360px;
  784 + height: 120px;
  785 + background: #ffffff;
  786 + left: calc(50% - 170px);
  787 + z-index: 999;
  788 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  789 + display: none;
  790 +}
  791 +.buffer_edit_body{
  792 + padding: 5px;
  793 +}
  794 +
  795 +.buffer_edit_body>.name{
  796 + font-weight: 600;
  797 + color: #E91E63;
  798 + margin-bottom: 0;
  799 +}
  800 +
  801 +.buffer_edit_body .ct_row .uk-inline{
  802 + width: 167px;
  803 + height: 30px;
  804 + margin-right: 7px;
  805 +}
  806 +
  807 +.buffer_edit_body .ct_row{
  808 + margin-top: 12px;
  809 +}
  810 +
  811 +.buffer_edit_body .ct_row .uk-inline:last-child{
  812 + margin-right: 0;
  813 +}
  814 +
  815 +.buffer_edit_body .ct_row .uk-inline input{
  816 + height: 30px;
  817 +}
  818 +
  819 +.buffer_edit_body .ct_row .uk-form-icon-flip {
  820 + font-size: 12px;
  821 +}
  822 +
  823 +.buffer_edit_body .ct_row .uk-inline.btns{
  824 + text-align: right;
  825 +}
  826 +.buffer_edit_body .ct_row .uk-inline.btns .uk-button{
  827 + padding: 0 15px;
  828 + height: 28px;
  829 + line-height: 28px;
  830 + vertical-align: top;
  831 + margin-top: 2px;
  832 +}
  833 +
  834 +.loading{
  835 + height: 100%;
  836 + text-align: center;
  837 + position: absolute;
  838 + z-index: 10000;
  839 + top: 0;
  840 + left: 0;
  841 + width: 100%;
  842 + background: #ffffff78;
  843 + display: flex;
  844 +}
  845 +
  846 +.loading>div{
  847 + margin: auto;
  848 + margin-top: calc(25% - 100px);
  849 + background: #f9d56c;
  850 + padding: 12px;
  851 + box-shadow: 5px 5px 15px rgba(90, 90, 90, 0.48);
  852 +}
  853 +
  854 +.loading>div>span{
  855 + vertical-align: top;
  856 + margin-top: -6px;
  857 + margin-right: 5px;
  858 + font-size: 14px;
  859 +}
  860 +.uk-modal{
  861 + z-index: 10001;
  862 +}
  863 +
  864 +.ct_route_badge.polygon{
  865 +
  866 +}
  867 +
  868 +.shapes_type>div.uk-inline:nth-of-type(2){
  869 + width: 80px;
  870 + margin-right: 0;
  871 +}
  872 +
  873 +.shapes_type>div.uk-inline:first-child{
  874 + width: 84px;
  875 +}
  876 +
  877 +.shapes_type>div.uk-inline:first-child select{
  878 + height: 30px;
  879 +}
  880 +
  881 +.shapes_type.st_d>div.uk-inline:nth-of-type(2){
  882 + display: none;
  883 +}
  884 +
  885 +.shapes_type.st_d>div.uk-inline:first-child{
  886 + width: 167px;
  887 +}
  888 +
  889 +.draw_polygon_switch{
  890 + display: none;
  891 +}
  892 +
  893 +.shapes_type.st_d>div.uk-inline:first-child select{
  894 + width: 107px;
  895 +}
  896 +
  897 +.shapes_type.st_d .draw_polygon_switch{
  898 + display: inline-block;
  899 + font-size: 12px;
  900 + vertical-align: bottom;
  901 + margin-left: 5px;
  902 +}
  903 +
  904 +.shapes_type.st_d .draw_polygon_switch>a{
  905 + color: red;
  906 +>>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f
  907 +}
0 908 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/f_road_route.html 0 → 100644
  1 +<div>
  2 + <script id="geo_d_e_road_route-temp" type="text/html">
  3 + <ul class="uk-list">
  4 + {{each list as subArr i}}
  5 + <li class="road_li_{{subArr[0].sectionCode}} first_road_active">
  6 + <a data-code="{{subArr[0].sectionCode}}" data-updown="{{subArr[0].directions}}">{{subArr[0].sectionName}}<span class="sub_name">{{subArr[0].crosesRoad}}</span></a>
  7 +
  8 + {{if subArr.length > 1}}
  9 + {{each subArr as obj j}}
  10 + <ul class="uk-list">
  11 + {{if j > 0}}
  12 + <li class="road_li_{{obj.sectionCode}}">
  13 + <a data-code="{{obj.sectionCode}}" data-updown="{{obj.directions}}">{{obj.sectionName}}<span class="sub_name">{{obj.crosesRoad}}</span></a></li>
  14 + {{/if}}
  15 + </ul>
  16 + {{/each}}
  17 + {{/if}}
  18 + </li>
  19 + {{/each}}
  20 + </ul>
  21 + </script>
  22 +
  23 + <script id="geo_d_e_road_info_win-temp" type="text/html">
  24 + <ul class="uk-list station_info_win">
  25 + <li class="s_name">{{sectionName}}</li>
  26 + <li>交叉路名: {{crosesRoad}}</li>
  27 + <li>路段编号:{{sectionCode}}</li>
  28 + <li>路由序号:{{sectionrouteCode}}</li>
  29 + <li>坐标:
  30 + <div class="ct_coord_str">
  31 + {{each bdCoords as coord i}}
  32 + <code>{{coord}}</code><br>
  33 + {{/each}}
  34 + </div>
  35 + </li>
  36 + </ul>
  37 + </script>
  38 +</div>
0 39 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/f_station_route.html 0 → 100644
  1 +<<<<<<< HEAD
  2 +<div>
  3 + <script id="geo_d_e_station_route-temp" type="text/html">
  4 + <ul class="uk-list">
  5 + {{each list as s i}}
  6 + <li class="station_li_{{s.stationCode}}">
  7 + <div class="ct_route_badge_wrap">
  8 + <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if s.shapesType=='d'}}polygon{{/if}}">
  9 + {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span>
  10 + </div>
  11 + <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a>
  12 + </li>
  13 + {{/each}}
  14 + </ul>
  15 + </script>
  16 +
  17 + <script id="geo_d_e_station_route_one-temp" type="text/html">
  18 + <li class="station_li_{{stationCode}}">
  19 + <div class="ct_route_badge_wrap">
  20 + <span class="uk-badge ct_route_badge {{if stationMark=='B'}}start{{else if stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}">
  21 + {{if stationMark=='B'}}起点站{{else if stationMark=='E'}}终点站{{else}}{{index}}{{/if}}</span>
  22 + </div>
  23 + <a class="uk-animation-shake" data-code="{{stationCode}}" data-updown="{{directions}}">{{stationName}}</a>
  24 + </li>
  25 + </script>
  26 +
  27 +
  28 + <script id="geo_d_e_station_info_win-temp" type="text/html">
  29 + <ul class="uk-list station_info_win">
  30 + <li class="s_name">{{stationName}}</li>
  31 + <li>站点编码: {{stationCode}}</li>
  32 + <li>站点类型:
  33 + {{if stationMark=='B'}}
  34 + 起点站
  35 + {{else if stationMark=='E'}}
  36 + 终点站
  37 + {{else if stationMark=='Z'}}
  38 + 中途站
  39 + {{/if}}
  40 + </li>
  41 + <li>
  42 + 经度: {{gLaty}}
  43 + </li>
  44 + <li>纬度: {{gLonx}}</li>
  45 + <li>
  46 + 电子围栏类型:
  47 + {{if shapesType=='r'}}
  48 + 圆形
  49 + {{else if shapesType=='d'}}
  50 + 多边形
  51 + {{/if}}
  52 + </li>
  53 + <li>
  54 + {{if shapesType=='r'}}
  55 + 半径:{{radius}}
  56 + {{/if}}
  57 + </li>
  58 + <li>站序:{{index + 1}}</li>
  59 + <li>路由序号:{{stationRouteCode}}</li>
  60 + </ul>
  61 + </script>
  62 +
  63 + <script id="geo_d_e_map_edit_buffer_panel-temp" type="text/html">
  64 + <div class="buffer_edit_panel uk-animation-slide-top-small">
  65 + <div class="buffer_edit_body" >
  66 + <h6 class="name">{{stationName}}(缓冲区编辑)</h6>
  67 + <form>
  68 + <input type="hidden" value="{{id}}" name="id">
  69 + <input type="hidden" value="{{directions}}" name="directions">
  70 + <input type="hidden" value="{{stationCode}}" name="stationCode">
  71 + <input type="hidden" value="{{stationName}}" name="stationName">
  72 + <div class="ct_row">
  73 + <div class="uk-inline">
  74 + <span class="uk-form-icon uk-form-icon-flip" >经度</span>
  75 + <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly>
  76 + </div>
  77 + <div class="uk-inline">
  78 + <span class="uk-form-icon uk-form-icon-flip" >纬度</span>
  79 + <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly>
  80 + </div>
  81 + </div>
  82 +
  83 + <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}">
  84 + <div class="uk-inline" >
  85 + <select name="shapesType" class="uk-select">
  86 + <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option>
  87 + <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option>
  88 + </select>
  89 + <span class="draw_polygon_switch" data-type="{{shapesType=='d'?'3':'1'}}"><a>{{shapesType=='d'?'重新绘制':'暂停绘制'}}</a></span>
  90 + </div>
  91 + <div class="uk-inline">
  92 + <span class="uk-form-icon uk-form-icon-flip" >半径</span>
  93 + <input class="uk-input" name="radius" type="text" value="{{radius}}">
  94 + </div>
  95 + <div class="uk-inline btns">
  96 + <button class="uk-button uk-button-primary submit">确定</button>
  97 + <button class="uk-button uk-button-default cancel">取消</button>
  98 + </div>
  99 + </div>
  100 + </form>
  101 + </div>
  102 + </div>
  103 + </script>
  104 +
  105 + <script id="geo_d_e_edit_name_panel-temp" type="text/html">
  106 + <div class="ul_li_input">
  107 + <form>
  108 + <input type="hidden" value="{{id}}" name="id">
  109 + <input type="hidden" value="{{stationCode}}" name="stationCode">
  110 + <input type="hidden" value="{{lineCode}}" name="lineCode">
  111 + <input type="hidden" value="{{stationMark}}" name="stationMark">
  112 + <input class="uk-input" autocomplete="off" value="{{stationName}}" name="stationName">
  113 + <span uk-icon="icon: check" title="确定" uk-tooltip class="save_icon_btn"></span>
  114 + <span uk-icon="icon: close" title="取消" uk-tooltip class="cancel_icon_btn"></span>
  115 + </form>
  116 + </div>
  117 + </script>
  118 +
  119 + <script id="geo_d_e_add_station_panel-temp" type="text/html">
  120 + <li class="station_li_transient">
  121 + <div class="ct_route_badge_wrap">
  122 + <span class="uk-badge ct_route_badge ">?</span>
  123 + </div>
  124 + <div class="ul_li_input">
  125 + <form>
  126 + <input class="uk-input" value="" autocomplete="off" placeholder="输入站点名称" name="stationName">
  127 + <span uk-icon="icon: location;ratio:.8" title="选择一个坐标位置" uk-tooltip class="search_point_icon_btn"></span>
  128 + <span uk-icon="icon: close" title="取消" uk-tooltip class="cancel_icon_btn"></span>
  129 + </form>
  130 + </div>
  131 + </li>
  132 + </script>
  133 +
  134 + <script id="geo_d_e_add_search_point_panel-temp" type="text/html">
  135 + <div class="add_station_search_point_wrap uk-animation-slide-top-small">
  136 + <div class="_title">为 {{name}} 选择一个坐标位置</div>
  137 + <div class="buffer_edit_body">
  138 + <form>
  139 + <div class="ct_row">
  140 + <div class="uk-inline">
  141 + <span class="uk-form-icon uk-form-icon-flip" >经度</span>
  142 + <input class="uk-input" name="gLaty" type="text" readonly>
  143 + </div>
  144 + <div class="uk-inline">
  145 + <span class="uk-form-icon uk-form-icon-flip" >纬度</span>
  146 + <input class="uk-input" name="gLonx" type="text" readonly>
  147 + </div>
  148 + </div>
  149 + <div class="ct_row shapes_type ">
  150 + <div class="uk-inline" >
  151 + <select name="shapesType" class="uk-select">
  152 + <option value="r" >圆形</option>
  153 + <option value="d" >多边形</option>
  154 + </select>
  155 + <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span>
  156 + </div>
  157 + <div class="uk-inline">
  158 + <span class="uk-form-icon uk-form-icon-flip" >半径</span>
  159 + <input class="uk-input" name="radius" type="text" >
  160 + </div>
  161 + <div class="uk-inline btns">
  162 + <button class="uk-button uk-button-primary submit">确定</button>
  163 + <button class="uk-button uk-button-default cancel">取消</button>
  164 + </div>
  165 + </div>
  166 + <div class="ct_row" style="color: #5e5d5d;font-size: 12px;">
  167 + <span uk-icon="icon: question;ratio:.7;" style="vertical-align: top;margin-top: 2px;"></span>
  168 + 双击地图拾取坐标点位
  169 + </div>
  170 + </form>
  171 + </div>
  172 + </div>
  173 + </script>
  174 +=======
  175 +<div>
  176 + <script id="geo_d_e_station_route-temp" type="text/html">
  177 + <ul class="uk-list">
  178 + {{each list as s i}}
  179 + <li class="station_li_{{s.stationCode}}">
  180 + <div class="ct_route_badge_wrap">
  181 + <span class="uk-badge ct_route_badge {{if s.stationMark=='B'}}start{{else if s.stationMark=='E'}}end{{/if}} {{if shapesType=='d'}}polygon{{/if}}">
  182 + {{if s.stationMark=='B'}}起点站{{else if s.stationMark=='E'}}终点站{{else}}{{i + 1}}{{/if}}</span>
  183 + </div>
  184 + <a data-code="{{s.stationCode}}" data-updown="{{s.directions}}">{{s.stationName}}</a>
  185 + </li>
  186 + {{/each}}
  187 + </ul>
  188 + </script>
  189 +
  190 +
  191 + <script id="geo_d_e_station_info_win-temp" type="text/html">
  192 + <ul class="uk-list station_info_win">
  193 + <li class="s_name">{{stationName}}</li>
  194 + <li>站点编码: {{stationCode}}</li>
  195 + <li>站点类型:
  196 + {{if stationMark=='B'}}
  197 + 起点站
  198 + {{else if stationMark=='E'}}
  199 + 终点站
  200 + {{else if stationMark=='Z'}}
  201 + 中途站
  202 + {{/if}}
  203 + </li>
  204 + <li>
  205 + 经度: {{gLaty}}
  206 + </li>
  207 + <li>纬度: {{gLonx}}</li>
  208 + <li>
  209 + 电子围栏类型:
  210 + {{if shapesType=='r'}}
  211 + 圆形
  212 + {{else if shapesType=='d'}}
  213 + 多边形
  214 + {{/if}}
  215 + </li>
  216 + <li>
  217 + {{if shapesType=='r'}}
  218 + 半径:{{radius}}
  219 + {{/if}}
  220 + </li>
  221 + <li>站序:{{index + 1}}</li>
  222 + <li>路由序号:{{stationRouteCode}}</li>
  223 + </ul>
  224 + </script>
  225 +
  226 + <script id="geo_d_e_map_edit_buffer_panel-temp" type="text/html">
  227 + <div class="buffer_edit_panel uk-animation-slide-top-small">
  228 + <div class="buffer_edit_body" >
  229 + <h6 class="name">{{stationName}}(缓冲区编辑)</h6>
  230 + <form>
  231 + <input type="hidden" value="{{id}}" name="id">
  232 + <input type="hidden" value="{{directions}}" name="directions">
  233 + <input type="hidden" value="{{stationCode}}" name="stationCode">
  234 + <input type="hidden" value="{{stationName}}" name="stationName">
  235 + <div class="ct_row">
  236 + <div class="uk-inline">
  237 + <span class="uk-form-icon uk-form-icon-flip" >经度</span>
  238 + <input class="uk-input" name="gLaty" type="text" value="{{bd_lat}}" readonly>
  239 + </div>
  240 + <div class="uk-inline">
  241 + <span class="uk-form-icon uk-form-icon-flip" >纬度</span>
  242 + <input class="uk-input" name="gLonx" type="text" value="{{bd_lon}}" readonly>
  243 + </div>
  244 + </div>
  245 +
  246 + <div class="ct_row shapes_type {{shapesType=='d'?'st_d':''}}">
  247 + <div class="uk-inline" >
  248 + <select name="shapesType" class="uk-select">
  249 + <option value="r" {{shapesType=='r'?'selected':''}}>圆形</option>
  250 + <option value="d" {{shapesType=='d'?'selected':''}}>多边形</option>
  251 + </select>
  252 + <span class="draw_polygon_switch" data-type="1"><a>暂停绘制</a></span>
  253 + </div>
  254 + <div class="uk-inline">
  255 + <span class="uk-form-icon uk-form-icon-flip" >半径</span>
  256 + <input class="uk-input" name="radius" type="text" value="{{radius}}">
  257 + </div>
  258 + <div class="uk-inline btns">
  259 + <button class="uk-button uk-button-primary submit">确定</button>
  260 + <button class="uk-button uk-button-default cancel">取消</button>
  261 + </div>
  262 + </div>
  263 + </form>
  264 + </div>
  265 + </div>
  266 + </script>
  267 +>>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f
  268 +</div>
0 269 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/left_card.html 0 → 100644
  1 +<!-- 左线路卡片面板 -->
0 2 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/fragments/rt_tools.html 0 → 100644
  1 +<!--- 右上工具栏 -->
0 2 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/common_data.js 0 → 100644
  1 +<!-- 数据 -->
  2 +var gb_common_data = function () {
  3 +
  4 +
  5 + res_load_ep.emitLater('load_common_data');
  6 + return {};
  7 +}();
0 8 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/history_edit_logs.js 0 → 100644
  1 +<!-- 历史编辑日志 -->
  2 +
  3 +var gb_history_edit_logs = function () {
  4 +
  5 +
  6 + res_load_ep.emitLater('load_history_edit_logs');
  7 + return {};
  8 +}();
0 9 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/map.js 0 → 100644
  1 +<<<<<<< HEAD
  2 +<!-- 地图操作 -->
  3 +
  4 +var gb_ct_map = function () {
  5 +
  6 + //初始化地图
  7 + if(!window.BMap){
  8 + alert('地图没有加载成功,请确认是否能正常连接外网!!');
  9 + }
  10 + var gb_map_consts = {
  11 + mapContainer: '#map_wrap',
  12 + center_point: {
  13 + lng: 121.544336,
  14 + lat: 31.221315
  15 + }
  16 + };
  17 +
  18 + /**
  19 + * 地图状态
  20 + * 1: 站点缓冲区编辑
  21 + */
  22 + var map_status=0;
  23 + var editCircle;
  24 + var editPolygon;
  25 + var dragMarker;
  26 +
  27 + map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false});
  28 + //中心点和缩放级别
  29 + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14);
  30 + map.enableScrollWheelZoom();
  31 +
  32 + var roadPolylines = [], stationMarkers=[];
  33 + var _render = function (cb) {
  34 + //绘制路段
  35 + _renderRoads(gb_road_route.getData());
  36 + //绘制站点
  37 + _renderStation(gb_station_route.getData());
  38 +
  39 + changeUpDown();
  40 +
  41 + //居中至上行中间站点
  42 + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];
  43 + map.setCenter(cm.point);
  44 +
  45 + cb && cb();
  46 + };
  47 +
  48 + var updownColor = function (updown) {
  49 + return updown==0?'blue':'red';
  50 + };
  51 + var _renderRoads = function (data) {
  52 + _renderPolyline(data[0], updownColor(0));//上行路段
  53 + _renderPolyline(data[1], updownColor(1));//下行路段
  54 + };
  55 +
  56 + var _renderStation = function (data) {
  57 + _renderStationMarket(data[0]);//上行站点
  58 + _renderStationMarket(data[1]);//下行站点
  59 + };
  60 +
  61 + var _renderStationMarket = function (routes, color) {
  62 + var marker;
  63 + var array=[];
  64 + $.each(routes, function (i) {
  65 + this.index = i;
  66 + transCoord(this);
  67 + marker=createStationMark(this);
  68 + marker.stationCode = this.stationCode;
  69 + marker.ct_data = this;
  70 + marker.ct_source='1';
  71 + map.addOverlay(marker);
  72 +
  73 + array.push(marker);
  74 + });
  75 +
  76 + stationMarkers.push(array);
  77 + };
  78 +
  79 + function transCoord(obj) {
  80 + var coord = TransGPS.wgsToBD(obj.gLaty, obj.gLonx);
  81 + obj.bd_lat = coord.lat;
  82 + obj.bd_lon = coord.lng;
  83 + }
  84 +
  85 + var _renderPolyline = function (routes, color) {
  86 + var pos, temps;
  87 + var polyline, _pLines=[];
  88 + var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7};
  89 + $.each(routes, function (i, item) {
  90 +
  91 + pos = [];
  92 + $.each(item.bdCoords, function () {
  93 + temps = this.split(' ');
  94 + pos.push(new BMap.Point(temps[0], temps[1]));
  95 + });
  96 + polyline = new BMap.Polyline(pos, style);
  97 + polyline.ct_data = item;
  98 + polyline.ct_data.oldColor = color;
  99 + polyline.ct_source='1';
  100 + map.addOverlay(polyline);
  101 +
  102 + polyline.addEventListener('mouseover', function(){
  103 + this.setStrokeColor('#20bd26');
  104 + });
  105 + polyline.addEventListener('mouseout', function(){
  106 + if(this!=road_win_show_p)
  107 + this.setStrokeColor(color);
  108 + });
  109 + polyline.addEventListener('click', function(e){
  110 + if(map_status!=1)
  111 + openRoadInfoWin(this, e.point);
  112 + });
  113 + _pLines.push(polyline);
  114 + });
  115 +
  116 + roadPolylines.push(_pLines);
  117 + };
  118 +
  119 + var road_win_show_p;
  120 + function openRoadInfoWin(p, point) {
  121 + var data = p.ct_data;
  122 + var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data));
  123 +
  124 + //close event
  125 + win.addEventListener('close', function (e) {
  126 + p.setStrokeColor(p.ct_data.oldColor);
  127 + gb_road_route.clearFocus();
  128 + road_win_show_p = null;
  129 + });
  130 + //open event
  131 + win.addEventListener('open', function (e) {
  132 + gb_road_route.focus(data);
  133 + p.setStrokeColor('#20bd26');
  134 + road_win_show_p = p;
  135 + });
  136 +
  137 + map.openInfoWindow(win, point);
  138 + }
  139 +
  140 + function createStationMark(statio) {
  141 + var point = new BMap.Point(statio.bd_lon, statio.bd_lat);
  142 + var marker = new BMap.Marker(point);
  143 +
  144 + //根据站点名称 计算marker 宽度
  145 + var w = statio.stationName.length * 12 + 38
  146 + ,iw=w-2;
  147 + var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,25)})
  148 + marker.setIcon(icon);
  149 + marker.setShadow(null);
  150 + //信息窗口
  151 + //var infoWin=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](statio), {offset: new BMap.Size(0,-13)});
  152 + //infoWin.ct_data = statio;//绑定数据
  153 + //marker.infoWin = infoWin;
  154 + marker.addEventListener('click', function(){
  155 + if(map_status!=1)
  156 + openStationInfoWin(this);
  157 + //map.openInfoWindow(this.infoWin, this.point);
  158 + });
  159 + //close event
  160 + /*infoWin.addEventListener('close', function (e) {
  161 + //if(map_status!=1)
  162 + gb_station_route.clearFocus();
  163 + });
  164 + //open event
  165 + infoWin.addEventListener('open', function (e) {
  166 + gb_station_route.focus(this.ct_data);
  167 + });*/
  168 +
  169 + //mouseover
  170 + marker.addEventListener('mouseover', function(){
  171 + setTop(this);
  172 + });
  173 + return marker;
  174 + }
  175 +
  176 + var openStationInfoWin = function (m) {
  177 + //ct_data
  178 + var win=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](m.ct_data), {offset: new BMap.Size(0,-13)});
  179 + //close event
  180 + win.addEventListener('close', function (e) {
  181 + gb_station_route.clearFocus();
  182 + });
  183 + //open event
  184 + win.addEventListener('open', function (e) {
  185 + gb_station_route.focus(m.ct_data);
  186 + });
  187 +
  188 + map.openInfoWindow(win, m.point);
  189 + };
  190 +
  191 + //绘制站点icon
  192 + function createStationIcon(station, w) {
  193 + var canvas = $('<canvas></canvas>')[0];
  194 + var ctx = canvas.getContext('2d');
  195 +
  196 + var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c';
  197 + //矩形
  198 + //ctx.roundRect(0, 0, w, 17, 1).stroke();
  199 + ctx.lineWidth="3";
  200 + ctx.rect(0, 0, w - 2, 19);
  201 + ctx.fillStyle = '#fff';
  202 + ctx.fill();
  203 + ctx.strokeStyle = bg;
  204 + ctx.stroke();
  205 + ctx.lineWidth="1";
  206 +
  207 + //文字
  208 + ctx.font = "12px arial";
  209 + ctx.fillStyle = '#000';
  210 + ctx.fillText(station.stationName, 27, 14);
  211 +
  212 + //序号
  213 + ctx.beginPath();
  214 + ctx.rect(0, 0, 20, 19);
  215 + ctx.fillStyle = bg;
  216 + ctx.fill();
  217 +
  218 + ctx.font = "12px arial";
  219 + ctx.fillStyle = '#fff';
  220 + var i = station.index + 1;
  221 + var left = (i + '').length > 1?3:7;
  222 + ctx.fillText(i, left, 14);
  223 +
  224 + //角
  225 + var c = w / 2;
  226 + ctx.beginPath();
  227 + ctx.moveTo(c - 7, 16);
  228 + ctx.lineTo(c, 24);
  229 + ctx.lineTo(c + 7, 16);
  230 + ctx.closePath();
  231 +
  232 + ctx.fillStyle = bg;
  233 + ctx.fill();
  234 + ctx.strokeStyle = '#fff';
  235 + ctx.stroke();
  236 + return canvas.toDataURL();
  237 + }
  238 +
  239 + var changeUpDown = function () {
  240 + var upDown = getUpDown();
  241 + $.each(roadPolylines[upDown==0?1:0], function () {
  242 + this.hide();
  243 + });
  244 + $.each(roadPolylines[upDown], function () {
  245 + this.show();
  246 + });
  247 +
  248 +
  249 + $.each(stationMarkers[upDown==0?1:0], function () {
  250 + this.hide();
  251 + });
  252 + $.each(stationMarkers[upDown], function () {
  253 + this.show();
  254 + });
  255 + };
  256 +
  257 + /**
  258 + * 定位到站点
  259 + * @param code
  260 + */
  261 + var focusStation = function (code, updown) {
  262 + var marker = getStationMarker(code, updown);
  263 + if(marker){
  264 + openStationInfoWin(marker);
  265 + }
  266 + };
  267 +
  268 + var getStationMarker = function (code, updown) {
  269 + var array = stationMarkers[updown],
  270 + marker;
  271 + for(var i=0,m;m=array[i++];){
  272 + if(m.stationCode==code){
  273 + marker = m;
  274 + break;
  275 + }
  276 + }
  277 + return marker;
  278 + }
  279 +
  280 + /**
  281 + * 定位到路段
  282 + * @param code
  283 + * @param updown
  284 + */
  285 + var focusRoad = function (code, updown) {
  286 + var array = roadPolylines[updown],
  287 + polyline;
  288 + for(var i=0,p;p=array[i++];){
  289 + if(p.ct_data.sectionCode==code){
  290 + polyline = p;
  291 + break;
  292 + }
  293 + }
  294 +
  295 + var cp = calcCenterPoint(p.ct_data.bdCoords);
  296 + openRoadInfoWin(p, new BMap.Point(cp.longitude, cp.latitude));
  297 + };
  298 +
  299 + var calcCenterPoint = function (coords) {
  300 + var array = [], strs;
  301 + for(var i=0,item;item=coords[i++];){
  302 + strs = item.split(' ');
  303 + array.push({latitude: strs[1], longitude: strs[0]});
  304 + }
  305 +
  306 + return geolib.getCenter(array);
  307 + };
  308 +
  309 + var exitEditBufferStatus = function (s) {
  310 + map_status = 0;
  311 + //enabledOtherElem();
  312 + //gb_station_route.hideEditPanel();
  313 +
  314 + clearOtherOverlay();
  315 + reSetDragMarker();//关闭marker 拖拽
  316 +
  317 + clearEditBuffer();
  318 + //map.removeOverlay(editCircle);
  319 +
  320 + openStationInfoWin(getStationMarker(s.stationCode, s.directions));
  321 + };
  322 +
  323 + /**
  324 + * 编辑站点缓冲区
  325 + * @param station
  326 + */
  327 + var editStationBuffer = function (s) {
  328 + map_status = 1;
  329 + map.closeInfoWindow();//关闭infoWindow
  330 + gb_station_route.clearFocus();
  331 + gb_station_route.focus(s);
  332 + disabledOtherElem();
  333 + gb_station_route.showEditPanel(s);
  334 +
  335 + var marker = getStationMarker(s.stationCode, s.directions);
  336 + setDragMarker(marker);//站点 点位可拖拽
  337 +
  338 + map.centerAndZoom(marker.point, 18);
  339 + var bElem = openBufferOverlay(marker);
  340 +
  341 + if(s.shapesType=='r'){
  342 + //lineupdate
  343 + bElem.addEventListener('lineupdate', function (e) {
  344 + //console.log('lineupdatelineupdate 1111', e);
  345 + gb_station_route.reWriteEditPanel(e.target);
  346 + });
  347 + }
  348 + else if(s.shapesType=='d'){
  349 + //调整多边形
  350 +
  351 + }
  352 + };
  353 +
  354 + var setDragMarker = function (marker) {
  355 + marker.enableDragging();
  356 + dragMarker = marker;
  357 + dragMarker._old_point = dragMarker.point;
  358 + //监听拖拽事件 dragging
  359 + dragMarker.addEventListener('dragging', dragMarkerDragEvent);
  360 + };
  361 +
  362 + var dragMarkerDragEvent = function () {
  363 + if(editPolygon){
  364 + if(!BMapLib.GeoUtils.isPointInPolygon(this.point, editPolygon))
  365 + dragMarker.setPosition(dragMarker._old_point);//还原位置
  366 +
  367 + gb_station_route.reWriteEditPanel(this, true);
  368 + }
  369 + else if(editCircle){
  370 + editCircle.disableEditing();
  371 + //缓冲区跟随点位运动
  372 + editCircle.setCenter(this.point);
  373 + editCircle.enableEditing();
  374 + }
  375 + };
  376 +
  377 + var reSetDragMarker = function () {
  378 + if(dragMarker){
  379 + dragMarker.setPosition(dragMarker._old_point);
  380 + dragMarker.removeEventListener('dragging', dragMarkerDragEvent);
  381 + dragMarker.disableDragging();
  382 + dragMarker = null;
  383 + }
  384 + };
  385 +
  386 +
  387 +/* var removeDragMarkerEvent = function () {
  388 + dragMarker.removeEventListener('dragging', dragMarkerDragEvent);
  389 + };*/
  390 +
  391 + /**
  392 + * 禁用其他元素
  393 + */
  394 + var disabledOtherElem = function () {
  395 + $('.main_left_panel_m_layer').show();
  396 + };
  397 +
  398 + var openBufferOverlay = function (m) {
  399 + var elem;
  400 + var data = m.ct_data;
  401 + if(data.shapesType=='r'){
  402 + elem = new BMap.Circle(m.point,data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/});
  403 + editCircle = elem;
  404 + }
  405 + else if(data.shapesType=='d'){
  406 + var array = data.bdCoords;
  407 + var pos = [];
  408 + var temp = [];
  409 + for(var i=0,c;c=array[i++];){
  410 + temp = c.split(' ');
  411 + pos.push(new BMap.Point(temp[0], temp[1]));
  412 + }
  413 +
  414 + elem = new BMap.Polygon(pos);
  415 + editPolygon = elem;
  416 + }
  417 +
  418 + map.addOverlay(elem);
  419 + elem.enableEditing();
  420 + return elem;
  421 + };
  422 +
  423 + /**
  424 + * 更新站点
  425 + * @param s
  426 + */
  427 + function updateStation(s) {
  428 + var m = getStationMarker(s.stationCode, s.directions);
  429 + //更新位置
  430 + transCoord(s);
  431 + m.ct_data = s;
  432 + m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat));
  433 + m._old_point = this.point;
  434 + m.disableDragging();
  435 + }
  436 +
  437 + var topOverlay;
  438 + function setTop(overlay){
  439 + if(topOverlay)
  440 + topOverlay.setTop(false);
  441 + overlay.setTop(true);
  442 + topOverlay = overlay;
  443 + }
  444 +
  445 + /**
  446 + * 切换缓冲区类型
  447 + * @param v
  448 + */
  449 + var _drawingManager;
  450 + var changeShapeType = function (v) {
  451 + clearEditBuffer();
  452 +
  453 + if(v == 'd'){
  454 + _drawingManager = new BMapLib.DrawingManager(map,{});
  455 + _drawingManager.open();
  456 + _drawingManager.enableCalculate();
  457 + _drawingManager.setDrawingMode('polygon');
  458 +
  459 + //绘制结束事件
  460 + _drawingManager.addEventListener('overlaycomplete', function (e) {
  461 + editPolygon = e.overlay;
  462 + gb_station_route.drawEnd();
  463 + });
  464 + }
  465 + else if(v == 'r'){
  466 + updateDragRadius(80);
  467 +
  468 + //圆形编辑事件 reWriteEditPanel
  469 + editCircle.addEventListener('lineupdate', function (e) {
  470 + gb_station_route.reWriteEditPanel(e.target);
  471 + });
  472 + /*map.removeOverlay(editCircle);
  473 + map.removeOverlay(editPolygon);
  474 +
  475 + //以站点为中心,生成一个默认的圆
  476 + var marker = getStationMarker(s.stationCode, s.directions);
  477 + editCircle = new BMap.Circle(marker.point,s.radius?s.radius:50, {strokeColor: '#E91E63'});
  478 + editCircle.enableEditing();
  479 + map.addOverlay(editCircle);*/
  480 + }
  481 + };
  482 +
  483 + var clearEditBuffer = function () {
  484 + map.removeOverlay(editCircle);
  485 + map.removeOverlay(editPolygon);
  486 + editCircle = null;
  487 + editPolygon = null;
  488 + };
  489 +
  490 + var updateDragRadius = function (radius) {
  491 + if(!editCircle){
  492 + clearOtherOverlay();
  493 + var s = gb_station_route.getRealEditStation();
  494 +
  495 + //以站点为中心,生成一个默认的圆
  496 + var marker = getStationMarker(s.stationCode, s.directions);
  497 + var circle = new BMap.Circle(marker.point,s.radius?s.radius:80, {strokeColor: '#E91E63'});
  498 +
  499 + setTimeout(function () {
  500 + circle.enableEditing();
  501 + }, 200);
  502 + map.addOverlay(circle);
  503 +
  504 + editCircle = circle;
  505 + }
  506 +
  507 + editCircle.setRadius(radius);
  508 + };
  509 +
  510 + var exitDrawStatus = function () {
  511 + if(_drawingManager){
  512 + clearOtherOverlay();
  513 + _drawingManager.close();
  514 + }
  515 + };
  516 +
  517 + var openDrawStatus = function () {
  518 + if(_drawingManager){
  519 + clearOtherOverlay();
  520 + _drawingManager.open();
  521 + }
  522 + };
  523 +
  524 + var clearOtherOverlay = function () {
  525 + var all = map.getOverlays();
  526 + for(var i=0,obj; obj=all[i++];){
  527 + if(obj.ct_source && obj.ct_source=='1')
  528 + continue;
  529 + map.removeOverlay(obj);
  530 + //obj = null;
  531 + }
  532 + };
  533 +
  534 + var closeInfoWin = function () {
  535 + map.closeInfoWindow();
  536 + };
  537 +
  538 + /**
  539 + * 为新增的站点选择一个位置
  540 + */
  541 + var showAddPointPanel = function (name) {
  542 + map_status = 1;
  543 + var spp = gb_station_route.getTemps()['geo_d_e_add_search_point_panel-temp']({name: name});
  544 + $('body').append(spp);
  545 +
  546 + //按名称定位地图位置
  547 + var local = new BMap.LocalSearch(map, {
  548 + renderOptions:{map: map},
  549 + onMarkersSet: function (pos) {
  550 + console.log('onMarkersSet', pos);
  551 + }
  552 + });
  553 + local.search(name + "-公交车站");
  554 + };
  555 +
  556 + res_load_ep.emitLater('load_map');
  557 + return {
  558 + _render: _render,
  559 + changeUpDown:changeUpDown,
  560 + focusStation: focusStation,
  561 + focusRoad: focusRoad,
  562 + editStationBuffer: editStationBuffer,
  563 + updateStation: updateStation,
  564 + exitEditBufferStatus: exitEditBufferStatus,
  565 + changeShapeType: changeShapeType,
  566 + exitDrawStatus: exitDrawStatus,
  567 + openDrawStatus: openDrawStatus,
  568 + getDrawPolygon: function () {
  569 + return editPolygon;
  570 + },
  571 + updateDragRadius: updateDragRadius,
  572 + closeInfoWin: closeInfoWin,
  573 + showAddPointPanel: showAddPointPanel,
  574 + resetMapStatus: function () {
  575 + map_status = 0;
  576 + }
  577 + };
  578 +=======
  579 +<!-- 地图操作 -->
  580 +
  581 +var gb_ct_map = function () {
  582 +
  583 + //初始化地图
  584 + if(!window.BMap){
  585 + alert('地图没有加载成功,请确认是否能正常连接外网!!');
  586 + }
  587 + var gb_map_consts = {
  588 + mapContainer: '#map_wrap',
  589 + center_point: {
  590 + lng: 121.544336,
  591 + lat: 31.221315
  592 + }
  593 + };
  594 +
  595 + /**
  596 + * 地图状态
  597 + * 1: 站点缓冲区编辑
  598 + */
  599 + var map_status=0;
  600 + var editCircle;
  601 + var editPolygon;
  602 +
  603 + map = new BMap.Map($(gb_map_consts.mapContainer)[0], {enableMapClick: false});
  604 + //中心点和缩放级别
  605 + map.centerAndZoom(new BMap.Point(gb_map_consts.center_point.lng, gb_map_consts.center_point.lat), 14);
  606 + map.enableScrollWheelZoom();
  607 +
  608 + var roadPolylines = [], stationMarkers=[];
  609 + var _render = function (cb) {
  610 + //绘制路段
  611 + _renderRoads(gb_road_route.getData());
  612 + //绘制站点
  613 + _renderStation(gb_station_route.getData());
  614 +
  615 + changeUpDown();
  616 +
  617 + //居中至上行中间站点
  618 + var cm = stationMarkers[0][parseInt(stationMarkers[0].length / 2)];
  619 + map.setCenter(cm.point);
  620 +
  621 + cb && cb();
  622 + };
  623 +
  624 + var updownColor = function (updown) {
  625 + return updown==0?'blue':'red';
  626 + };
  627 + var _renderRoads = function (data) {
  628 + _renderPolyline(data[0], updownColor(0));//上行路段
  629 + _renderPolyline(data[1], updownColor(1));//下行路段
  630 + };
  631 +
  632 + var _renderStation = function (data) {
  633 + _renderStationMarket(data[0]);//上行站点
  634 + _renderStationMarket(data[1]);//下行站点
  635 + };
  636 +
  637 + var _renderStationMarket = function (routes, color) {
  638 + var marker;
  639 + var array=[];
  640 + $.each(routes, function (i) {
  641 + this.index = i;
  642 + transCoord(this);
  643 + marker=createStationMark(this);
  644 + marker.stationCode = this.stationCode;
  645 + marker.ct_data = this;
  646 + map.addOverlay(marker);
  647 +
  648 + array.push(marker);
  649 + });
  650 +
  651 + stationMarkers.push(array);
  652 + };
  653 +
  654 + function transCoord(obj) {
  655 + var coord = TransGPS.wgsToBD(obj.gLaty, obj.gLonx);
  656 + obj.bd_lat = coord.lat;
  657 + obj.bd_lon = coord.lng;
  658 + }
  659 +
  660 + var _renderPolyline = function (routes, color) {
  661 + var pos, temps;
  662 + var polyline, _pLines=[];
  663 + var style = {strokeWeight:7, strokeColor: color, strokeOpacity: .7};
  664 + $.each(routes, function (i, item) {
  665 +
  666 + pos = [];
  667 + $.each(item.bdCoords, function () {
  668 + temps = this.split(' ');
  669 + pos.push(new BMap.Point(temps[0], temps[1]));
  670 + });
  671 + polyline = new BMap.Polyline(pos, style);
  672 + polyline.ct_data = item;
  673 + polyline.ct_data.oldColor = color;
  674 + map.addOverlay(polyline);
  675 +
  676 + polyline.addEventListener('mouseover', function(){
  677 + this.setStrokeColor('#20bd26');
  678 + });
  679 + polyline.addEventListener('mouseout', function(){
  680 + if(this!=road_win_show_p)
  681 + this.setStrokeColor(color);
  682 + });
  683 + polyline.addEventListener('click', function(e){
  684 + if(map_status!=1)
  685 + openRoadInfoWin(this, e.point);
  686 + });
  687 + _pLines.push(polyline);
  688 + });
  689 +
  690 + roadPolylines.push(_pLines);
  691 + };
  692 +
  693 + var road_win_show_p;
  694 + function openRoadInfoWin(p, point) {
  695 + var data = p.ct_data;
  696 + var win = new BMap.InfoWindow(gb_road_route.getTemps()['geo_d_e_road_info_win-temp'](data));
  697 +
  698 + //close event
  699 + win.addEventListener('close', function (e) {
  700 + p.setStrokeColor(p.ct_data.oldColor);
  701 + gb_road_route.clearFocus();
  702 + road_win_show_p = null;
  703 + });
  704 + //open event
  705 + win.addEventListener('open', function (e) {
  706 + gb_road_route.focus(data);
  707 + p.setStrokeColor('#20bd26');
  708 + road_win_show_p = p;
  709 + });
  710 +
  711 + map.openInfoWindow(win, point);
  712 + }
  713 +
  714 + function createStationMark(statio) {
  715 + var point = new BMap.Point(statio.bd_lon, statio.bd_lat);
  716 + var marker = new BMap.Marker(point);
  717 +
  718 + //根据站点名称 计算marker 宽度
  719 + var w = statio.stationName.length * 12 + 38
  720 + ,iw=w-2;
  721 + var icon = new BMap.Icon(createStationIcon(statio, w), new BMap.Size(iw,24), {anchor: new BMap.Size(iw/2,25)})
  722 + marker.setIcon(icon);
  723 + marker.setShadow(null);
  724 + //信息窗口
  725 + //var infoWin=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](statio), {offset: new BMap.Size(0,-13)});
  726 + //infoWin.ct_data = statio;//绑定数据
  727 + //marker.infoWin = infoWin;
  728 + marker.addEventListener('click', function(){
  729 + if(map_status!=1)
  730 + openStationInfoWin(this);
  731 + //map.openInfoWindow(this.infoWin, this.point);
  732 + });
  733 + //close event
  734 + /*infoWin.addEventListener('close', function (e) {
  735 + //if(map_status!=1)
  736 + gb_station_route.clearFocus();
  737 + });
  738 + //open event
  739 + infoWin.addEventListener('open', function (e) {
  740 + gb_station_route.focus(this.ct_data);
  741 + });*/
  742 +
  743 + //mouseover
  744 + marker.addEventListener('mouseover', function(){
  745 + setTop(this);
  746 + });
  747 + return marker;
  748 + }
  749 +
  750 + var openStationInfoWin = function (m) {
  751 + //ct_data
  752 + var win=new BMap.InfoWindow(gb_station_route.getTemps()['geo_d_e_station_info_win-temp'](m.ct_data), {offset: new BMap.Size(0,-13)});
  753 + //close event
  754 + win.addEventListener('close', function (e) {
  755 + gb_station_route.clearFocus();
  756 + });
  757 + //open event
  758 + win.addEventListener('open', function (e) {
  759 + gb_station_route.focus(m.ct_data);
  760 + });
  761 +
  762 + map.openInfoWindow(win, m.point);
  763 + };
  764 +
  765 + //绘制站点icon
  766 + function createStationIcon(station, w) {
  767 + var canvas = $('<canvas></canvas>')[0];
  768 + var ctx = canvas.getContext('2d');
  769 +
  770 + var bg = station.directions == 0 ? '#5757fc' : '#fc4c4c';
  771 + //矩形
  772 + //ctx.roundRect(0, 0, w, 17, 1).stroke();
  773 + ctx.lineWidth="3";
  774 + ctx.rect(0, 0, w - 2, 19);
  775 + ctx.fillStyle = '#fff';
  776 + ctx.fill();
  777 + ctx.strokeStyle = bg;
  778 + ctx.stroke();
  779 + ctx.lineWidth="1";
  780 +
  781 + //文字
  782 + ctx.font = "12px arial";
  783 + ctx.fillStyle = '#000';
  784 + ctx.fillText(station.stationName, 27, 14);
  785 +
  786 + //序号
  787 + ctx.beginPath();
  788 + ctx.rect(0, 0, 20, 19);
  789 + ctx.fillStyle = bg;
  790 + ctx.fill();
  791 +
  792 + ctx.font = "12px arial";
  793 + ctx.fillStyle = '#fff';
  794 + var i = station.index + 1;
  795 + var left = (i + '').length > 1?3:7;
  796 + ctx.fillText(i, left, 14);
  797 +
  798 + //角
  799 + var c = w / 2;
  800 + ctx.beginPath();
  801 + ctx.moveTo(c - 7, 16);
  802 + ctx.lineTo(c, 24);
  803 + ctx.lineTo(c + 7, 16);
  804 + ctx.closePath();
  805 +
  806 + ctx.fillStyle = bg;
  807 + ctx.fill();
  808 + ctx.strokeStyle = '#fff';
  809 + ctx.stroke();
  810 + return canvas.toDataURL();
  811 + }
  812 +
  813 + var changeUpDown = function () {
  814 + var upDown = getUpDown();
  815 + $.each(roadPolylines[upDown==0?1:0], function () {
  816 + this.hide();
  817 + });
  818 + $.each(roadPolylines[upDown], function () {
  819 + this.show();
  820 + });
  821 +
  822 +
  823 + $.each(stationMarkers[upDown==0?1:0], function () {
  824 + this.hide();
  825 + });
  826 + $.each(stationMarkers[upDown], function () {
  827 + this.show();
  828 + });
  829 + };
  830 +
  831 + /**
  832 + * 定位到站点
  833 + * @param code
  834 + */
  835 + var focusStation = function (code, updown) {
  836 + var marker = getStationMarker(code, updown);
  837 + if(marker){
  838 + openStationInfoWin(marker);
  839 + }
  840 + };
  841 +
  842 + var getStationMarker = function (code, updown) {
  843 + var array = stationMarkers[updown],
  844 + marker;
  845 + for(var i=0,m;m=array[i++];){
  846 + if(m.stationCode==code){
  847 + marker = m;
  848 + break;
  849 + }
  850 + }
  851 + return marker;
  852 + }
  853 +
  854 + /**
  855 + * 定位到路段
  856 + * @param code
  857 + * @param updown
  858 + */
  859 + var focusRoad = function (code, updown) {
  860 + var array = roadPolylines[updown],
  861 + polyline;
  862 + for(var i=0,p;p=array[i++];){
  863 + if(p.ct_data.sectionCode==code){
  864 + polyline = p;
  865 + break;
  866 + }
  867 + }
  868 +
  869 + var cp = calcCenterPoint(p.ct_data.bdCoords);
  870 + openRoadInfoWin(p, new BMap.Point(cp.longitude, cp.latitude));
  871 + }
  872 +
  873 + var calcCenterPoint = function (coords) {
  874 + var array = [], strs;
  875 + for(var i=0,item;item=coords[i++];){
  876 + strs = item.split(' ');
  877 + array.push({latitude: strs[1], longitude: strs[0]});
  878 + }
  879 +
  880 + return geolib.getCenter(array);
  881 + }
  882 +
  883 + var exitEditBufferStatus = function (s) {
  884 + map_status = 0;
  885 + enabledOtherElem();
  886 + gb_station_route.hideEditPanel();
  887 +
  888 + map.removeOverlay(editCircle);
  889 +
  890 + openStationInfoWin(getStationMarker(s.stationCode, s.directions));
  891 + };
  892 +
  893 + /**
  894 + * 编辑站点缓冲区
  895 + * @param station
  896 + */
  897 + var editStationBuffer = function (s) {
  898 + map_status = 1;
  899 + map.closeInfoWindow();//关闭infoWindow
  900 + gb_station_route.clearFocus();
  901 + gb_station_route.focus(s);
  902 + clearOldOverlay();
  903 + disabledOtherElem();
  904 + gb_station_route.showEditPanel(s);
  905 +
  906 + var marker = getStationMarker(s.stationCode, s.directions);
  907 + map.centerAndZoom(marker.point, 18);
  908 + var bElem = openBufferOverlay(marker);
  909 +
  910 + if(s.shapesType=='r'){
  911 + //lineupdate
  912 + bElem.addEventListener('lineupdate', function (e) {
  913 + //console.log('lineupdatelineupdate', e);
  914 + //var ec = e.target;
  915 + //var radius = ec.getRadius().toFixed(2);
  916 + //console.log('getRadius', ec.getRadius(), radius);
  917 + gb_station_route.reWriteEditPanel(e.target);
  918 + });
  919 + }
  920 + };
  921 +
  922 + var clearOldOverlay = function () {
  923 + map.removeOverlay(editCircle);
  924 + map.removeOverlay(editPolygon);
  925 + }
  926 +
  927 + /**
  928 + * 禁用其他元素
  929 + */
  930 + var disabledOtherElem = function () {
  931 + $('.main_left_panel_m_layer').show();
  932 + }
  933 +
  934 + var enabledOtherElem = function () {
  935 + $('.main_left_panel_m_layer').hide();
  936 + }
  937 +
  938 + var openBufferOverlay = function (m) {
  939 + var elem;
  940 + var data = m.ct_data;
  941 + if(data.shapesType=='r'){
  942 + var circle = new BMap.Circle(m.point,data.radius, {strokeColor: '#E91E63'/*updownColor(data.directions)*/});
  943 + map.addOverlay(circle);
  944 + circle.enableEditing();
  945 + }
  946 + editCircle = circle;
  947 + return circle;
  948 + };
  949 +
  950 + /**
  951 + * 更新站点
  952 + * @param s
  953 + */
  954 + function updateStation(s) {
  955 + var m = getStationMarker(s.stationCode, s.directions);
  956 + //更新位置
  957 + transCoord(s);
  958 + m.ct_data = s;
  959 + m.setPosition(new BMap.Point(s.bd_lon, s.bd_lat));
  960 + }
  961 +
  962 + var topOverlay;
  963 + function setTop(overlay){
  964 + if(topOverlay)
  965 + topOverlay.setTop(false);
  966 + overlay.setTop(true);
  967 + topOverlay = overlay;
  968 + }
  969 +
  970 + /**
  971 + * 切换缓冲区类型
  972 + * @param v
  973 + */
  974 + var _drawingManager;
  975 + var changeShapeType = function (v) {
  976 + if(v == 'd'){
  977 + map.removeOverlay(editCircle);
  978 +
  979 + _drawingManager = new BMapLib.DrawingManager(map,{});
  980 + _drawingManager.open();
  981 + _drawingManager.setDrawingMode('polygon');
  982 +
  983 + //绘制结束事件
  984 + _drawingManager.addEventListener('polygoncomplete', function (e) {
  985 + console.log('end ', e);
  986 + gb_station_route.drawEnd();
  987 + });
  988 + }
  989 + };
  990 +
  991 + var exitDrawStatus = function () {
  992 + if(_drawingManager)
  993 + _drawingManager.close();
  994 + };
  995 +
  996 + var openDrawStatus = function () {
  997 + if(_drawingManager)
  998 + _drawingManager.open();
  999 + };
  1000 + res_load_ep.emitLater('load_map');
  1001 + return {
  1002 + _render: _render,
  1003 + changeUpDown:changeUpDown,
  1004 + focusStation: focusStation,
  1005 + focusRoad: focusRoad,
  1006 + editStationBuffer: editStationBuffer,
  1007 + updateStation: updateStation,
  1008 + exitEditBufferStatus: exitEditBufferStatus,
  1009 + changeShapeType: changeShapeType,
  1010 + exitDrawStatus: exitDrawStatus,
  1011 + openDrawStatus: openDrawStatus
  1012 + };
  1013 +>>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f
  1014 +}();
0 1015 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/road_route.js 0 → 100644
  1 +<!-- 路段路由 -->
  2 +var gb_road_route = function () {
  3 +
  4 + var temps;
  5 + var road_maps;
  6 + //绘制线路路由
  7 + var init = function (cb) {
  8 + var lineCode = storage.getItem("geo_data_edit_line_code");
  9 +
  10 + var ep = EventProxy.create("data", "temp", function (data, temp) {
  11 + road_maps = data;
  12 + temps = temp;
  13 + console.log('roads', road_maps);
  14 +
  15 + //按顺序,名称分组
  16 + var ups = _group(road_maps[0]);
  17 + var downs = _group(road_maps[1]);
  18 + console.log('upsupsups', ups, 'downsdownsdowns', downs);
  19 + //渲染
  20 + var upHtmlStr = temps['geo_d_e_road_route-temp']({list: ups});
  21 + $('.up_down_route_list>li:first>.road_route').html(upHtmlStr);
  22 + var downHtmlStr = temps['geo_d_e_road_route-temp']({list: downs});
  23 + $('.up_down_route_list>li:last>.road_route').html(downHtmlStr);
  24 +
  25 + cb && cb();
  26 + });
  27 +
  28 + //加载数据
  29 + gb_common.$get('/_geo_data/findGeoRoad', {lineCode: lineCode}, function (rs) {
  30 + rs.list.sort(function (a, b) {
  31 + return parseInt(a.sectionrouteCode) - parseInt(b.sectionrouteCode);
  32 + });
  33 + ep.emit('data', gb_common.groupBy(rs.list, 'directions'));
  34 + });
  35 +
  36 + //加载模板片段
  37 + $.get('/pages/base/geo_data_edit/fragments/f_road_route.html', function (dom) {
  38 + ep.emit('temp', gb_common.compileTempByDom(dom, {
  39 + compress: true
  40 + }));
  41 + });
  42 + };
  43 +
  44 + //路段单击
  45 + $('.up_down_route_list>li>.road_route').on('click', 'a[data-code]', function () {
  46 + var code = $(this).data('code'),
  47 + updown = $(this).data('updown');
  48 +
  49 + clearFocus();
  50 + gb_ct_map.focusRoad(code, updown);
  51 + });
  52 +
  53 + var _group = function (list) {
  54 + var rs = [], tempArr = [];
  55 +
  56 + var name;
  57 + for (var i = 0, obj; obj = list[i++];) {
  58 + if (name && name != obj.sectionName) {
  59 + rs.push(tempArr);
  60 + tempArr = [];
  61 + }
  62 + tempArr.push(obj);
  63 + name = obj.sectionName
  64 + }
  65 + return rs;
  66 + };
  67 +
  68 + var clearFocus = function () {
  69 + $('.up_down_route_list>li>.road_route li.ct_active').removeClass('ct_active');
  70 + };
  71 +
  72 + var focus = function (data) {
  73 + //sectionCode
  74 + var elem = $('.up_down_route_list>li>.road_route .road_li_' + data.sectionCode);
  75 + elem.addClass('ct_active');
  76 +
  77 + if (!isShow(elem)) {
  78 + //定位滚动条
  79 + var cont = $('.up_down_route_list'),
  80 + diff = cont.height() / 2;
  81 + cont.animate({
  82 + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff
  83 + }, 500);
  84 + }
  85 + };
  86 +
  87 + var isShow = function (elem) {
  88 + var wrap = $('.up_down_route_list');
  89 + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122;
  90 + };
  91 +
  92 + res_load_ep.emitLater('load_road_route');
  93 + return {
  94 + init: init, getData: function () {
  95 + return road_maps;
  96 + },
  97 + getTemps: function () {
  98 + return temps;
  99 + },
  100 + clearFocus: clearFocus,
  101 + focus: focus
  102 + };
  103 +}();
0 104 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/station_route.js 0 → 100644
  1 +<<<<<<< HEAD
  2 +<!-- 站点路由 -->
  3 +var gb_station_route = function () {
  4 +
  5 + var temps;
  6 + var station_maps;
  7 + //绘制线路路由
  8 + var init = function (cb) {
  9 + var lineCode = storage.getItem("geo_data_edit_line_code");
  10 +
  11 + var ep = EventProxy.create("data", "temp", function (data, temp) {
  12 + station_maps = data;
  13 + temps = temp;
  14 + console.log('station', station_maps);
  15 + //渲染页面
  16 + var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]});
  17 + $('.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 + $('.up_down_route_list>li:last>.station_route').html(downHtmlStr);
  20 +
  21 + cb && cb();
  22 + });
  23 +
  24 + //加载数据
  25 + gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode}, function (rs) {
  26 + rs.list.sort(function (a, b) {
  27 + return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode);
  28 + });
  29 + ep.emit('data', gb_common.groupBy(rs.list, 'directions'));
  30 + });
  31 +
  32 + //加载模板片段
  33 + $.get('/pages/base/geo_data_edit/fragments/f_station_route.html', function (dom) {
  34 + ep.emit('temp', gb_common.compileTempByDom(dom, {
  35 + compress: true
  36 + }));
  37 + });
  38 + };
  39 +
  40 + //站点单击
  41 + $('.up_down_route_list>li>.station_route').on('click', 'a[data-code]', function () {
  42 + var code = $(this).data('code'),
  43 + updown = $(this).data('updown');
  44 +
  45 + clearFocus();
  46 + gb_ct_map.focusStation(code, updown);
  47 + });
  48 +
  49 + var clearFocus = function () {
  50 + $('.up_down_route_list>li>.station_route li.ct_active').removeClass('ct_active');
  51 + };
  52 +
  53 + var focus = function (s) {
  54 + var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode);
  55 + elem.addClass('ct_active');
  56 +
  57 + if (!isShow(elem)) {
  58 + //定位滚动条
  59 + var cont = $('.up_down_route_list'),
  60 + diff = cont.height() / 2;
  61 + cont.animate({
  62 + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff
  63 + }, 500);
  64 + }
  65 + };
  66 +
  67 + var isShow = function (elem) {
  68 + var wrap = $('.up_down_route_list');
  69 + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122;
  70 + };
  71 +
  72 + var getStation = function (code, updown) {
  73 + var array = station_maps[updown];
  74 + for(var i=0,s;s=array[i++];){
  75 + if(s.stationCode==code)
  76 + return s;
  77 + }
  78 + return null;
  79 + };
  80 +
  81 + /**
  82 + * 编辑站点名称
  83 + * @param station
  84 + */
  85 + var station_edit_name = function (station) {
  86 + var cellWrap = getStationLI(station);
  87 + $('a[data-code]', cellWrap).hide();
  88 +
  89 + cellWrap.append(temps['geo_d_e_edit_name_panel-temp'](station)).addClass('_edit_name');
  90 + //焦点
  91 + $('input[name=stationName]', cellWrap).focus();
  92 + //取消
  93 + $('.cancel_icon_btn', cellWrap).on('click', function () {
  94 + $('.ul_li_input', cellWrap).remove();
  95 + $('a[data-code]', cellWrap).show();
  96 + });
  97 + };
  98 +
  99 + var getStationLI = function (s) {
  100 + return $('.up_down_route_list>li:eq('+s.directions+')>.station_route .station_li_' + s.stationCode);
  101 + };
  102 +
  103 + var insert_station_before = function (station) {
  104 + //在之前插入站点
  105 + var cell = getStationLI(station);
  106 +
  107 + var addCell = $(temps['geo_d_e_add_station_panel-temp'](station));
  108 + cell.before(addCell);
  109 +
  110 + gb_ct_map.closeInfoWin();
  111 + //焦点
  112 + var $nameInput = $('input[name=stationName]', addCell);
  113 + $nameInput.focus();
  114 + //取消
  115 + $('.cancel_icon_btn', addCell).on('click', function () {
  116 + addCell.remove();
  117 + });
  118 +
  119 + //选择地图位置
  120 + $('.search_point_icon_btn', addCell).on('click', function () {
  121 + var name = $nameInput.val();
  122 + if(!name)
  123 + return UIkit.notification("你必须输入站点名称!", {status: 'danger',pos: 'bottom-left'});
  124 +
  125 + $('.main_left_panel_m_layer').show();
  126 + gb_ct_map.showAddPointPanel(name);
  127 + });
  128 + };
  129 +
  130 + var realEditStation;
  131 + var callbackHandler = {
  132 + edit_buffer: function (station) {
  133 + gb_ct_map.editStationBuffer(station);
  134 + },
  135 + edit_name: station_edit_name,
  136 + insert_before: insert_station_before
  137 + };
  138 +
  139 + $.contextMenu({
  140 + selector: '._route_info_wrap .up_down_route_list .station_route>ul>li>a[data-code]',
  141 + className: 'station-route-ct-menu',
  142 + callback: function (key, options) {
  143 + var aLink = options.$trigger;
  144 + var code = aLink.data('code'),
  145 + updown = aLink.data('updown');
  146 + var station = getStation(code, updown);
  147 + realEditStation = station;
  148 + callbackHandler[key] && callbackHandler[key](station);
  149 + },
  150 + items: {
  151 + 'edit_buffer': {
  152 + name: '编辑缓冲区'
  153 + },
  154 + 'sep1': '---------',
  155 + 'edit_name': {
  156 + name: '修改站点名称'
  157 + },
  158 + 'insert_before': {
  159 + name: '新增站点(之前)'
  160 + },
  161 + 'insert_after': {
  162 + name: '新增站点(之后)'
  163 + },
  164 + 'destroy': {
  165 + name: '撤销站点'
  166 + }
  167 + }
  168 + });
  169 +
  170 + var showEditPanel = function (s) {
  171 + var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s);
  172 + $('.ct_page').append(htmlStr);
  173 + $('.buffer_edit_panel').show();
  174 + };
  175 +
  176 + var edPanelRunFlag;
  177 + var ecObj;
  178 + var reWriteEditPanel = function (ec, isPolygon) {
  179 + if(edPanelRunFlag){
  180 + ecObj = ec;
  181 + return;
  182 + }
  183 +
  184 + edPanelRunFlag = true;
  185 + setTimeout(function () {
  186 + var panel = $('.buffer_edit_panel');
  187 + var p;
  188 + if(!isPolygon){
  189 + $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径
  190 + p = ecObj.getCenter();
  191 + }else{
  192 + p = ecObj.point;
  193 + }
  194 +
  195 + $('[name=gLaty]', panel).val(p.lat);
  196 + $('[name=gLonx]', panel).val(p.lng);
  197 + edPanelRunFlag = false;
  198 + }, 170);
  199 + };
  200 +
  201 + var update = function (s) {
  202 + var array = station_maps[s.directions];
  203 + for(var i=0,item; item=array[i++];){
  204 + if(item.stationCode==s.stationCode){
  205 + s.index = i;
  206 + array.splice(i - 1, 1, s);
  207 + break;
  208 + }
  209 + }
  210 +
  211 + //替换
  212 + var sCell = $(temps['geo_d_e_station_route_one-temp'](s));
  213 + $('a.uk-animation-shake', sCell).on('webkitAnimationEnd', function () {
  214 + $(this).removeClass('uk-animation-shake');
  215 + });
  216 + getStationLI(s).replaceWith(sCell);
  217 + };
  218 +
  219 + //取消按钮
  220 + $(document).on('click','.buffer_edit_body button.cancel', function (e) {
  221 + $('.main_left_panel_m_layer').hide();
  222 + $(this).parents('.buffer_edit_body').parent().remove();
  223 + gb_ct_map.resetMapStatus();
  224 + });
  225 +
  226 +
  227 + var $editWrap = '.buffer_edit_panel>.buffer_edit_body';
  228 + /**
  229 + * 缓冲区编辑 取消
  230 + */
  231 + $(document).on('click', $editWrap + ' button.cancel', function (e) {
  232 + var f = $(this).parents('form');
  233 + var data = f.serializeJSON();
  234 +
  235 + gb_ct_map.exitEditBufferStatus(data);
  236 + });
  237 +
  238 + /**
  239 + * 缓冲区编辑 切换缓冲区类型(圆形,多边形)
  240 + */
  241 + $(document).on('change', $editWrap +' select[name=shapesType]', function (e) {
  242 + var v = $(this).val();
  243 + if(v=='d'){
  244 + $('.buffer_edit_panel .shapes_type').addClass('st_d');
  245 + }
  246 + else{
  247 + $('.buffer_edit_panel .shapes_type').removeClass('st_d');
  248 + $('input[name=radius]', $editWrap).val(80);
  249 + }
  250 + gb_ct_map.changeShapeType(v);
  251 + });
  252 +
  253 + /**
  254 + * 半径修改
  255 + */
  256 + var update_radius_flag, update_radius;
  257 + $(document).on('input', $editWrap +' input[name=radius]', function (e) {
  258 + update_radius = $(this).val();
  259 + if(update_radius_flag){
  260 + return;
  261 + }
  262 + update_radius_flag = true;
  263 + setTimeout(function () {
  264 + gb_ct_map.updateDragRadius(update_radius);
  265 + update_radius_flag = false;
  266 + }, 180);
  267 + });
  268 +
  269 + /**
  270 + * 缓冲区编辑 切换绘制模式
  271 + */
  272 + var drawPolygonSwitch = $editWrap +' .draw_polygon_switch';
  273 + $(document).on('click', drawPolygonSwitch, function (e) {
  274 + var type = $(this).data('type');
  275 + if(type==1){
  276 + //退出绘制状态
  277 + gb_ct_map.exitDrawStatus();
  278 + $(this).data('type', 0).find('a').text('开始绘制');
  279 + }
  280 + else if(type==0 || type==2){
  281 + gb_ct_map.openDrawStatus();
  282 + $(this).data('type', 1).find('a').text('暂停绘制');
  283 + }
  284 + else if(type==3){
  285 + gb_ct_map.changeShapeType('d');
  286 + $(this).data('type', 1).find('a').text('暂停绘制');
  287 + }
  288 + });
  289 +
  290 + /**
  291 + * 绘制结束
  292 + */
  293 + var drawEnd = function () {
  294 + $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制');
  295 + };
  296 +
  297 + res_load_ep.emitLater('load_station_route');
  298 + return {
  299 + init: init,
  300 + getData: function () {
  301 + return station_maps;
  302 + },
  303 + getTemps: function () {
  304 + return temps;
  305 + },
  306 + clearFocus: clearFocus,
  307 + focus: focus,
  308 + showEditPanel: showEditPanel,
  309 + reWriteEditPanel: reWriteEditPanel,
  310 + update: update,
  311 + drawEnd: drawEnd,
  312 + getRealEditStation: function () {
  313 + return realEditStation;
  314 + }
  315 + };
  316 +=======
  317 +<!-- 站点路由 -->
  318 +var gb_station_route = function () {
  319 +
  320 + var temps;
  321 + var station_maps;
  322 + //绘制线路路由
  323 + var init = function (cb) {
  324 + var lineCode = storage.getItem("geo_data_edit_line_code");
  325 +
  326 + var ep = EventProxy.create("data", "temp", function (data, temp) {
  327 + station_maps = data;
  328 + temps = temp;
  329 + console.log('station', station_maps);
  330 + //渲染页面
  331 + var upHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[0]});
  332 + $('.up_down_route_list>li:first>.station_route').html(upHtmlStr);
  333 + var downHtmlStr = temps['geo_d_e_station_route-temp']({list: station_maps[1]});
  334 + $('.up_down_route_list>li:last>.station_route').html(downHtmlStr);
  335 +
  336 + cb && cb();
  337 + });
  338 +
  339 + //加载数据
  340 + gb_common.$get('/_geo_data/findGeoStations', {lineCode: lineCode}, function (rs) {
  341 + rs.list.sort(function (a, b) {
  342 + return parseInt(a.stationRouteCode) - parseInt(b.stationRouteCode);
  343 + });
  344 + ep.emit('data', gb_common.groupBy(rs.list, 'directions'));
  345 + });
  346 +
  347 + //加载模板片段
  348 + $.get('/pages/base/geo_data_edit/fragments/f_station_route.html', function (dom) {
  349 + ep.emit('temp', gb_common.compileTempByDom(dom, {
  350 + compress: true
  351 + }));
  352 + });
  353 + };
  354 +
  355 + //站点单击
  356 + $('.up_down_route_list>li>.station_route').on('click', 'a[data-code]', function () {
  357 + var code = $(this).data('code'),
  358 + updown = $(this).data('updown');
  359 +
  360 + clearFocus();
  361 + gb_ct_map.focusStation(code, updown);
  362 + });
  363 +
  364 + var clearFocus = function () {
  365 + $('.up_down_route_list>li>.station_route li.ct_active').removeClass('ct_active');
  366 + };
  367 +
  368 + var focus = function (s) {
  369 + var elem = $('.up_down_route_list>li>.station_route .station_li_' + s.stationCode);
  370 + elem.addClass('ct_active');
  371 +
  372 + if (!isShow(elem)) {
  373 + //定位滚动条
  374 + var cont = $('.up_down_route_list'),
  375 + diff = cont.height() / 2;
  376 + cont.animate({
  377 + scrollTop: elem.offset().top - cont.offset().top + cont.scrollTop() - diff
  378 + }, 500);
  379 + }
  380 + };
  381 +
  382 + var isShow = function (elem) {
  383 + var wrap = $('.up_down_route_list');
  384 + return elem.offset().top < wrap.height() + 122 && elem.offset().top > 122;
  385 + };
  386 +
  387 + var getStation = function (code, updown) {
  388 + var array = station_maps[updown];
  389 + for(var i=0,s;s=array[i++];){
  390 + if(s.stationCode==code)
  391 + return s;
  392 + }
  393 + return null;
  394 + };
  395 +
  396 + var callbackHandler = {
  397 + edit_buffer: function (station) {
  398 + //编辑缓冲区
  399 + gb_ct_map.editStationBuffer(station);
  400 + }
  401 + };
  402 +
  403 + $.contextMenu({
  404 + selector: '._route_info_wrap .up_down_route_list .station_route>ul>li',
  405 + className: 'station-route-ct-menu',
  406 + callback: function (key, options) {
  407 + var aLink = options.$trigger.find('a[data-code]');
  408 + var code = aLink.data('code'),
  409 + updown = aLink.data('updown');
  410 + var station = getStation(code, updown);
  411 + callbackHandler[key] && callbackHandler[key](station);
  412 + },
  413 + items: {
  414 + 'edit_buffer': {
  415 + name: '编辑缓冲区'
  416 + },
  417 + 'sep1': '---------',
  418 + 'edit': {
  419 + name: '编辑基础信息'
  420 + },
  421 + 'insert_before': {
  422 + name: '新增站点(前)'
  423 + },
  424 + 'insert_after': {
  425 + name: '新增站点(后)'
  426 + }
  427 + }
  428 + });
  429 +
  430 + var showEditPanel = function (s) {
  431 + var htmlStr = temps['geo_d_e_map_edit_buffer_panel-temp'](s);
  432 + $('.ct_page').append(htmlStr);
  433 + $('.buffer_edit_panel').show();
  434 + };
  435 +
  436 + var hideEditPanel = function () {
  437 + $('.buffer_edit_panel').remove();
  438 + };
  439 +
  440 + var edPanelRunFlag;
  441 + var ecObj;
  442 + var reWriteEditPanel = function (ec) {
  443 + if(edPanelRunFlag){
  444 + ecObj = ec;
  445 + return;
  446 + }
  447 +
  448 + edPanelRunFlag = true;
  449 + setTimeout(function () {
  450 + var panel = $('.buffer_edit_panel');
  451 + $('[name=radius]', panel).val(parseInt(ecObj.getRadius()));//半径
  452 +
  453 + var p = ecObj.getCenter();
  454 + $('[name=gLaty]', panel).val(p.lat);
  455 + $('[name=gLonx]', panel).val(p.lng);
  456 + edPanelRunFlag = false;
  457 + }, 170);
  458 + };
  459 +
  460 + var update = function (s) {
  461 + var array = station_maps[s.directions];
  462 + for(var i=0,item; item=array[i++];){
  463 + if(item.stationCode==s.stationCode){
  464 + s.index = i;
  465 + array.splice(i, 1, s);
  466 + break;
  467 + }
  468 + }
  469 + };
  470 +
  471 + /**
  472 + * 缓冲区编辑 取消
  473 + */
  474 + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.cancel', function (e) {
  475 + var f = $(this).parents('form');
  476 + var data = f.serializeJSON();
  477 +
  478 + gb_ct_map.exitEditBufferStatus(data);
  479 + });
  480 +
  481 + /**
  482 + * 缓冲区编辑 切换缓冲区类型(圆形,多边形)
  483 + */
  484 + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body select[name=shapesType]', function (e) {
  485 + var v = $(this).val();
  486 +
  487 + gb_ct_map.changeShapeType(v);
  488 + if(v=='d'){
  489 + $('.buffer_edit_panel .shapes_type').addClass('st_d');
  490 +
  491 +
  492 + //
  493 + //UIkit.notification("使用鼠标在地图上绘制多边形,可点击上发“暂停绘制”链接,退出绘制模式,以拖拽地图", {status: 'primary', pos: 'bottom-center'})
  494 + }
  495 + else{
  496 + $('.buffer_edit_panel .shapes_type').removeClass('st_d');
  497 + }
  498 + });
  499 +
  500 + /**
  501 + * 缓冲区编辑 切换绘制模式
  502 + */
  503 + var drawPolygonSwitch = '.buffer_edit_panel>.buffer_edit_body .draw_polygon_switch';
  504 + $(document).on('click', drawPolygonSwitch, function (e) {
  505 + var type = $(this).data('type');
  506 + if(type==1){
  507 + //退出绘制状态
  508 + gb_ct_map.exitDrawStatus();
  509 + $(this).data('type', 0).find('a').text('开始绘制');
  510 + }
  511 + else if(type==0 || type==2){
  512 + gb_ct_map.openDrawStatus();
  513 + $(this).data('type', 1).find('a').text('暂停绘制');
  514 + }
  515 + });
  516 +
  517 + /**
  518 + * 绘制结束
  519 + */
  520 + var drawEnd = function () {
  521 + $(drawPolygonSwitch).data('type', 2).find('a').text('重新绘制');
  522 + };
  523 +
  524 +
  525 + res_load_ep.emitLater('load_station_route');
  526 + return {
  527 + init: init,
  528 + getData: function () {
  529 + return station_maps;
  530 + },
  531 + getTemps: function () {
  532 + return temps;
  533 + },
  534 + clearFocus: clearFocus,
  535 + focus: focus,
  536 + showEditPanel: showEditPanel,
  537 + hideEditPanel: hideEditPanel,
  538 + reWriteEditPanel: reWriteEditPanel,
  539 + update: update,
  540 + drawEnd: drawEnd
  541 + };
  542 +>>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f
  543 +}();
0 544 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/submit.js 0 → 100644
  1 +<<<<<<< HEAD
  2 +/**
  3 + * 事件代理,提交数据
  4 + */
  5 +var gb_data_submit = function () {
  6 +
  7 + /**
  8 + * 缓冲区编辑提交
  9 + */
  10 + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.submit', function (e) {
  11 + var f = $(this).parents('form');
  12 + var data = f.serializeJSON();
  13 + UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() {
  14 + if(data.shapesType=='d'){
  15 + var polygon = gb_ct_map.getDrawPolygon();
  16 + if(null == polygon){
  17 + alert('失败,无法获取到 polygon..');
  18 + return;
  19 + }
  20 + var pos = polygon.getPath();
  21 + //闭合
  22 + pos.push(pos[0]);
  23 + var gPolygonGrid = '';
  24 + for(var i=0,p;p=pos[i++];){
  25 + gPolygonGrid += (p.lng + " " + p.lat + ",");
  26 + }
  27 + data.gPolygonGrid = gPolygonGrid.substr(0, gPolygonGrid.length - 1);
  28 + }
  29 +
  30 + //gb_ct_map.removeDragMarkerEvent();
  31 + show_run_text('正在提交缓冲区信息...');
  32 + gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) {
  33 + hide_run_text();
  34 + UIkit.notification("提交成功!", {status: 'success'});
  35 + //更新前端数据
  36 + gb_station_route.update(rs.station);
  37 + gb_ct_map.updateStation(rs.station);
  38 +
  39 + //退出编辑模式
  40 + gb_ct_map.exitEditBufferStatus(rs.station);
  41 + });
  42 + });
  43 + return false;
  44 + });
  45 +
  46 + /**
  47 + * 修改名称提交
  48 + */
  49 + $(document).on('click', '.up_down_route_list .station_route .ul_li_input .save_icon_btn', function (e) {
  50 + var f = $(this).parents('form');
  51 + var data = f.serializeJSON();
  52 +
  53 + UIkit.modal.confirm('确定将站点名称修改为【'+data.stationName+'】?').then(function() {
  54 + show_run_text('正在保存...');
  55 +
  56 + gb_common.$post('/_geo_data/updateStationName', data, function (rs) {
  57 + hide_run_text();
  58 + UIkit.notification("修改成功!", {status: 'success'});
  59 + gb_station_route.update(rs.station);
  60 + });
  61 + });
  62 + });
  63 +
  64 + var show_run_text = function (t) {
  65 + $('.text', $loadPanel).text(t);
  66 + $loadPanel.show();
  67 + };
  68 +
  69 + var hide_run_text = function () {
  70 + $('.text', $loadPanel).text('');
  71 + $loadPanel.hide();
  72 + };
  73 + return {};
  74 +=======
  75 +/**
  76 + * 事件代理,提交数据
  77 + */
  78 +var gb_data_submit = function () {
  79 +
  80 + /**
  81 + * 缓冲区编辑提交
  82 + */
  83 + $(document).on('click', '.buffer_edit_panel>.buffer_edit_body button.submit', function (e) {
  84 + var f = $(this).parents('form');
  85 + var data = f.serializeJSON();
  86 + UIkit.modal.confirm('确定保存【'+data.stationName+'】的缓冲区信息?').then(function() {
  87 +
  88 + //console.log('aaa',f, f.serializeJSON());
  89 + show_run_text('正在提交缓冲区信息');
  90 + gb_common.$post('/_geo_data/updateBufferInfo', data, function (rs) {
  91 + hide_run_text();
  92 + UIkit.notification("提交成功!", {status: 'success'});
  93 +
  94 + //更新前端数据
  95 + gb_station_route.update(rs.station);
  96 + gb_ct_map.updateStation(rs.station);
  97 +
  98 + //退出编辑模式
  99 + gb_ct_map.exitEditBufferStatus(rs.station);
  100 + });
  101 + }, function () {
  102 + console.log('Rejected.')
  103 + });
  104 + return false;
  105 + });
  106 +
  107 + var show_run_text = function (t) {
  108 + $('.text', $loadPanel).text(t);
  109 + $loadPanel.show();
  110 + };
  111 +
  112 + var hide_run_text = function () {
  113 + $('.text', $loadPanel).text('');
  114 + $loadPanel.hide();
  115 + };
  116 + return {};
  117 +>>>>>>> 5330d6cb797891dcb6c8a000004d51964e2bb71f
  118 +}();
0 119 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/js/version_manage.js 0 → 100644
  1 +<!-- 版本管理 -->
  2 +
  3 +var gb_version_manage = function () {
  4 +
  5 + res_load_ep.emitLater('load_version_manage');
  6 + return {};
  7 +}();
0 8 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/main.html 0 → 100644
  1 +<!DOCTYPE html>
  2 +<html lang="zh-cn">
  3 +
  4 +<head>
  5 + <meta charset="UTF-8">
  6 + <link rel="stylesheet" href="/assets/plugins/uk3.0/uikit.min.css"/>
  7 + <link rel="stylesheet" href="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.css" />
  8 + <!-- jquery contextMenu style -->
  9 + <link rel="stylesheet" href="/real_control_v2/assets/css/jquery.contextMenu.min.css" />
  10 + <link rel="stylesheet"
  11 + href="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.css"
  12 + type="text/css" />
  13 + <!-- main css -->
  14 + <link rel="stylesheet" href="/pages/base/geo_data_edit/css/mian.css" />
  15 +</head>
  16 +
  17 +<body>
  18 +<div class="loading">
  19 + <div><span uk-spinner></span><span class="text">正在加载...</span></div>
  20 +</div>
  21 +<div class="ct_page" >
  22 + <div id="map_wrap"></div>
  23 + <div class="main_left_panel_m_layer"></div>
  24 + <div class="main_left_panel">
  25 + <div class="_line_info">
  26 + <div class="_line_name">
  27 + 961路
  28 + <a uk-icon="icon: plus" class="add_line_version_icon" title="添加一个新的线路版本" uk-tooltip></a>
  29 + </div>
  30 + <div class="_version_dropdown_wrap">
  31 + <a class="_version_text">原始版本 <i uk-icon="icon: chevron-down;ratio:.6"></i></a>
  32 + <div uk-dropdown>
  33 + <ul class="uk-nav uk-dropdown-nav">
  34 + <li class="uk-nav-header">历史</li>
  35 + <li><a>原始版本</a></li>
  36 + <li class="uk-nav-divider"></li>
  37 + <li class="uk-nav-header">启用</li>
  38 + <li class="uk-active"><a>20171206线路改道</a></li>
  39 + <li class="uk-nav-header">未来</li>
  40 + <li><a>20180206线路改道</a></li>
  41 + </ul>
  42 + </div>
  43 + </div>
  44 + <span class="clock_enable_version">
  45 + <a uk-icon="icon: clock;ratio: .7" class=""></a> 25:30:20 启用(20180206线路改道)
  46 + </span>
  47 + </div>
  48 +
  49 + <div class="_route_info_wrap">
  50 + <ul uk-tab>
  51 + <li><a>上行</a></li>
  52 + <li><a>下行</a></li>
  53 +
  54 + <span class="rt_show_version_txt uk-badge uk-disabled">
  55 + 20180206线路改道
  56 + </span>
  57 + </ul>
  58 +
  59 + <ul class="uk-switcher uk-margin up_down_route_list">
  60 + <li>
  61 + <div class="station_route"></div>
  62 + <div class="road_route"></div>
  63 + </li>
  64 + <li>
  65 + <div class="station_route"></div>
  66 + <div class="road_route"></div>
  67 + </li>
  68 + </ul>
  69 + <div class="pos_tb_icon">
  70 + <a uk-icon="icon: chevron-down;"></a>
  71 + </div>
  72 + </div>
  73 + </div>
  74 + <div class="main_lt_search_panel">
  75 + <div class="uk-inline">
  76 + <span class="uk-form-icon uk-form-icon-flip" uk-icon="icon: search"></span>
  77 + <input class="uk-input search_input" placeholder="搜索地图位置" type="text">
  78 + </div>
  79 + </div>
  80 + <div class="main_rt_tools_panel">
  81 + <a uk-icon="icon: info;ratio: .9" class="_icon"></a>
  82 + <a uk-icon="icon: expand;ratio: .9" class="_icon full_screen_icon"></a>
  83 + </div>
  84 +</div>
  85 +<!-- 百度 -->
  86 +<script src="http://api.map.baidu.com/api?v=2.0&ak=IGGrr4UjwIYzatoCRFKEL8sT"></script>
  87 +<script src="/metronic_v4.5.4/plugins/jquery.min.js"></script>
  88 +<script src="/assets/plugins/uk3.0/uikit.min.js"></script>
  89 +<script src="/assets/plugins/uk3.0/uikit-icons.min.js"></script>
  90 +<script src="/real_control_v2/assets/plugins/perfect-scrollbar/perfect-scrollbar.jquery.js" ></script>
  91 +<!-- EventProxy -->
  92 +<script src="/assets/js/eventproxy.js"></script>
  93 +<!-- art-template 模版引擎 -->
  94 +<script src="/assets/plugins/template.js"></script>
  95 +<script src="/real_control_v2/assets/plugins/moment/moment.min.js"></script>
  96 +<!-- jquery.serializejson JSON序列化插件 -->
  97 +<script src="/assets/plugins/jquery.serializejson.js" merge="plugins"></script>
  98 +<!-- common js -->
  99 +<script src="/real_control_v2/js/common.js"></script>
  100 +<script src="/assets/js/TransGPS.js" ></script>
  101 +<!-- Geolib -->
  102 +<script src="/real_control_v2/geolib/geolib.js" ></script>
  103 +<!-- jquery contextMenu -->
  104 +<script src="/real_control_v2/assets/js/jquery.contextMenu.min.js" ></script>
  105 +<script src="/assets/js/baidu/bd_GeoUtils_min.js" ></script>
  106 +
  107 +<script>
  108 + var $loadPanel = $('body>.loading');
  109 + //___________________________________
  110 + var storage = window.localStorage;
  111 + storage.setItem("geo_data_edit_line_code" , "70123");
  112 + //___________________________________
  113 +
  114 + top.document.title = "绘制线路";
  115 + // 关闭左侧栏
  116 + if (!top.$('body').hasClass('page-sidebar-closed')) {top.$('.menu-toggler.sidebar-toggler').click();}
  117 + //全屏
  118 + $('.full_screen_icon').on('click', function () {
  119 + window.parent.$('#geo_edit_wrap_iframe').addClass('full_screen');
  120 + });
  121 +
  122 + var gb_main_ep = new EventProxy()
  123 + //文件加载
  124 + var res_load_ep = EventProxy.create('load_common_data', 'load_station_route','load_road_route'
  125 + , 'load_version_manage', 'load_history_edit_logs', 'load_map', function () {
  126 +
  127 + //UIkit.notification('加载完成!!');
  128 + var eq = gb_main_ep;
  129 +
  130 + //站点
  131 + gb_station_route.init(g_emit('init_road'));
  132 + //路段
  133 + eq.once('init_road', function () {
  134 + gb_road_route.init(g_emit('init_map'))
  135 + });
  136 + //地图
  137 + eq.once('init_map', function () {
  138 + gb_ct_map._render(g_emit('end'));
  139 + });
  140 +
  141 + eq.once('end', function () {
  142 + $loadPanel.hide();
  143 + });
  144 + });
  145 +
  146 + function g_emit(id) {
  147 + console.log('g_emit [' + id + ']');
  148 + return function () {
  149 + console.log('eq.emitLater(' + id + ')');
  150 + return gb_main_ep.emitLater(id);
  151 + };
  152 + }
  153 +
  154 + //滚动条
  155 + $('._route_info_wrap>ul.uk-switcher').perfectScrollbar({suppressScrollX: true});
  156 +
  157 + //to top btttom
  158 + $('.pos_tb_icon a').on('click', function () {
  159 + UIkit.notification('top top...');
  160 + });
  161 +
  162 + function getUpDown(){
  163 + return $('._route_info_wrap>ul>li:first').hasClass('uk-active')?0:1;
  164 + }
  165 +
  166 + //切换上下行显示
  167 + $('.up_down_route_list').on('show', function () {
  168 + gb_ct_map.changeUpDown();
  169 + });
  170 +</script>
  171 +
  172 +<!--- js -->
  173 +<script src="/pages/base/geo_data_edit/js/common_data.js" ></script>
  174 +<script src="/pages/base/geo_data_edit/js/station_route.js" ></script>
  175 +<script src="/pages/base/geo_data_edit/js/road_route.js" ></script>
  176 +<script src="/pages/base/geo_data_edit/js/version_manage.js" ></script>
  177 +<script src="/pages/base/geo_data_edit/js/history_edit_logs.js" ></script>
  178 +<script src="/pages/base/geo_data_edit/js/map.js" ></script>
  179 +<script src="/pages/base/geo_data_edit/js/submit.js" ></script>
  180 +<script type="text/javascript"
  181 + src="http://api.map.baidu.com/library/DrawingManager/1.4/src/DrawingManager_min.js"></script>
  182 +</body>
  183 +</html>
0 184 \ No newline at end of file
... ...
src/main/resources/static/pages/base/geo_data_edit/uk3_wrap.html 0 → 100644
  1 +<style>
  2 + iframe.full_screen{
  3 + width: 100%;
  4 + height: 100%;
  5 + position: fixed;
  6 + z-index: 9999999;
  7 + top: 0;
  8 + left: 0;
  9 + margin-left: 0 !important;
  10 + padding-left: 0;
  11 + padding-top: 0;
  12 + }
  13 +</style>
  14 +<iframe id="geo_edit_wrap_iframe" src="/pages/base/geo_data_edit/main.html?origin=real_control_iframe" frameborder="0" style="height: 100%;width: 100%;"></iframe>
0 15 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/addstation.html 0 → 100644
  1 +<!-- 新增站点 -->
  2 +<div class="modal fade" id="add_station_mobal" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">新增站点</h4>
  8 + </div>
  9 + <div class="modal-body">
  10 + <form class="form-horizontal" role="form" id="add_station_form" action="/module" method="post">
  11 + <div class="alert alert-danger display-hide"> <button class="close" data-close="alert"></button>
  12 + 您的输入有误,请检查下面的输入项
  13 + </div>
  14 + <!-- 线路ID -->
  15 + <input type="hidden" name="lineId" id="lineIdInput" value="" />
  16 + <input type="hidden" name="bPolygonGrid" id="bPolygonGridInput" value="" />
  17 + <input type="hidden" name="gPolygonGrid" id="gPolygonGridInput" value="" />
  18 + <input type="hidden" name="gJwpoints" id="gJwpointsInput">
  19 + <input type="hidden" name="dbType" id="dbTypeInput" value="b"/>
  20 + <input type="hidden" name="x" id="xInput" value=""/>
  21 + <input type="hidden" name="y" id="yInput" value=""/>
  22 + <!-- 站点名称 -->
  23 + <div class="form-body">
  24 + <div class="form-group">
  25 + <label class="control-label col-md-3">
  26 + <span class="required"> * </span> 站点名称&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  27 + </label>
  28 + <div class="col-md-6">
  29 + <input type="text" class="form-control" name="zdmc" id="zdmcInput" placeholder="站点名称" readonly="readonly">
  30 + </div>
  31 + </div>
  32 + </div>
  33 + <!-- 站点路由名称 -->
  34 + <div class="form-body">
  35 + <div class="form-group">
  36 + <label class="control-label col-md-3">
  37 + <span class="required"> * </span> 站点路由名称:
  38 + </label>
  39 + <div class="col-md-6">
  40 + <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
  41 + </div>
  42 + </div>
  43 + </div>
  44 + <!-- 站点编码 -->
  45 + <div class="form-body">
  46 + <div class="form-group">
  47 + <label class="control-label col-md-3">
  48 + <span class="required"> * </span>站点编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  49 + </label>
  50 + <div class="col-md-6">
  51 + <input type="text" class="form-control" name="stationCod" id="stationCodInput" readonly="readonly">
  52 + </div>
  53 + </div>
  54 + </div>
  55 + <!-- 站点方向 -->
  56 + <div class="form-body">
  57 + <div class="form-group">
  58 + <label class="control-label col-md-3">
  59 + <span class="required"> * </span>站点方向&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  60 + </label>
  61 + <div class="col-md-6">
  62 + <select name="directions" class="form-control" id="stationdirSelect">
  63 + <option value="">-- 请选择站点类型 --</option>
  64 + <option value="0">上行</option>
  65 + <option value="1">下行</option>
  66 + </select>
  67 + </div>
  68 + </div>
  69 + </div>
  70 +
  71 + <!-- 站点序号 -->
  72 + <div class="form-body">
  73 + <div class="form-group">
  74 + <label class="control-label col-md-3">
  75 + <span class="required"> * </span>站点序号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  76 + </label>
  77 + <div class="col-md-6">
  78 + <select name="stationRouteCode" class="form-control" id="stationrouteSelect" style="width:100%"></select>
  79 + <span class="help-block">说明:选择的站点将作为本站序号的参考,成为选择站点的下一站。 </span>
  80 + </div>
  81 + </div>
  82 + </div>
  83 +
  84 + <!-- 站点类型 -->
  85 + <div class="form-body">
  86 + <div class="form-group">
  87 + <label class="control-label col-md-3">
  88 + <span class="required"> * </span>站点类型&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
  89 + </label>
  90 + <div class="col-md-6">
  91 + <select name="stationMark" class="form-control" id="stationMarkSelect">
  92 + <option value="">-- 请选择站点类型 --</option>
  93 + <option value="B">起点站</option>
  94 + <option value="Z">中途站</option>
  95 + <option value="E">终点站</option>
  96 + <option value="T">停车场</option>
  97 + </select>
  98 + </div>
  99 + </div>
  100 + </div>
  101 + <!-- 中心位置坐标点 -->
  102 + <div class="form-body">
  103 + <div class="form-group">
  104 + <label class="col-md-3 control-label"><span class="required"> * </span>经纬度坐标点:</label>
  105 + <div class="col-md-6">
  106 + <input type="text" class="form-control" name="bJwpoints" id="bJwpointsInput">
  107 + </div>
  108 + </div>
  109 + </div>
  110 + <!-- 几何图形类型 -->
  111 + <div class="form-body">
  112 + <div class="form-group">
  113 + <label class="col-md-3 control-label"><span class="required"> * </span>几何图形类型:</label>
  114 + <div class="col-md-6">
  115 + <input type="text" class="form-control" name="shapesType" id="shapesTypeSelect" placeholder="几何图形类型" readonly="readonly">
  116 + </div>
  117 + </div>
  118 + </div>
  119 + <!-- 圆形半径 -->
  120 + <div class="form-body" id="radiusGroup">
  121 + <div class="form-group">
  122 + <label class="col-md-3 control-label"><span class="required"> * </span>圆形半径&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  123 + <div class="col-md-6">
  124 + <input type="text" class="form-control" name="radius" id="radiusInput" placeholder="圆形半径">
  125 + </div>
  126 + </div>
  127 + </div>
  128 + <!-- 是否撤销 -->
  129 + <div class="form-body">
  130 + <div class="form-group">
  131 + <label class="col-md-3 control-label"><span class="required"> * </span>是否撤销&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  132 + <div class="col-md-6">
  133 + <select name="destroy" class="form-control" id="destroySelect">
  134 + <option value="">-- 请选择撤销类型 --</option>
  135 + <option value="0">否</option>
  136 + <option value="1">是</option>
  137 + </select>
  138 + </div>
  139 + </div>
  140 + </div>
  141 +
  142 + <!-- 道路编码-->
  143 + <div class="form-body">
  144 + <div class="form-group">
  145 + <label class="control-label col-md-3">道路编码&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  146 + <div class="col-md-6">
  147 + <input type="text" class="form-control" name="roadCoding" id="roadCodingCodInput">
  148 + </div>
  149 + </div>
  150 + </div>
  151 + <!-- 到站时间 -->
  152 + <div class="form-body">
  153 + <div class="form-group">
  154 + <label class="col-md-3 control-label">到站时间&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  155 + <div class="col-md-6">
  156 + <input type="text" class="form-control" name="toTime" id="toTimeInput" >
  157 + <span class="help-block">单位:分钟(min)</span>
  158 + </div>
  159 + </div>
  160 + </div>
  161 + <!-- 到站距离 -->
  162 + <div class="form-body">
  163 + <div class="form-group">
  164 + <label class="col-md-3 control-label">到站距离&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  165 + <div class="col-md-6">
  166 + <input type="text" class="form-control" name="distances" id="distancesInput" >
  167 + <span class="help-block">单位:公里(km)</span>
  168 + </div>
  169 + </div>
  170 + </div>
  171 + <!-- 版本号 -->
  172 + <div class="form-body">
  173 + <div class="form-group">
  174 + <label class="col-md-3 control-label">版本号&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:</label>
  175 + <div class="col-md-6">
  176 + <input type="text" class="form-control" name="versions" id='versionsInput' Readonly>
  177 + </div>
  178 + </div>
  179 + </div>
  180 +
  181 + <!-- 描述/说明 -->
  182 + <div class="form-group">
  183 + <label class="control-label col-md-3"> 描述/说明&nbsp;&nbsp;&nbsp;&nbsp;: </label>
  184 + <div class="col-md-6">
  185 + <textarea class="form-control" rows="3" name="descriptions" id="descriptionsTextarea" placeholder="描述/说明"></textarea>
  186 + </div>
  187 + </div>
  188 + </form>
  189 + </div>
  190 + <div class="modal-footer">
  191 + <button type="button" class="btn default" data-dismiss="modal" id="addMobalHiden">取消</button>
  192 + <button type="button" class="btn btn-primary" id="addStationButton">提交数据</button>
  193 + </div>
  194 + </div>
  195 + </div>
  196 +</div>
  197 +<script type="text/javascript">
  198 +$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,staobj,editRoute,fun){
  199 + var Station = staobj;
  200 + var Line = editRoute.getLineObj();
  201 + // 延迟加载
  202 + setTimeout(function(){
  203 + // 显示mobal
  204 + $('#add_station_mobal').modal({show : true,backdrop: 'static', keyboard: false});
  205 + },200);
  206 + // 当调用 hide 实例方法时触发
  207 + $('#add_station_mobal').on('hide.bs.modal', function () {
  208 + closeMobleSetClean();
  209 + });
  210 + // 当模态框对用户可见时触发(将等待 CSS 过渡效果完成)。
  211 + $('#add_station_mobal').on('show.bs.modal', function () {
  212 + // 获取站点编码元素,添加站点编码值
  213 + ajaxd.getStationCode(function(stationCode) {
  214 + // 线路ID.
  215 + $('#lineIdInput').val(Line.id);
  216 + // 获取站点名称元素设值.
  217 + $('#zdmcInput').val(Station.stationNamebootbox);
  218 + // 获取站点路由名称元素设值.
  219 + $('#stationNameInput').val(Station.stationNamebootbox);
  220 + // 站点编码.
  221 + $('#stationCodInput').val(stationCode).attr('Readonly','Readonly');
  222 + // 获取方向元素,并添加值.
  223 + $('#stationdirSelect').val(Line.dir).attr('Readonly','Readonly');
  224 + // 百度地图经纬度坐标中心点.
  225 + $('#bJwpointsInput').val(Station.bJwpoints).attr('Readonly','Readonly');
  226 + // 百度坐标点图形集合.
  227 + $('#bPolygonGridInput').val(Station.bPolygonGrid);
  228 + // 获取图形类型元素,并添加值
  229 + if(Station.shapesType=='r')
  230 + $('#shapesTypeSelect').val('圆形');
  231 + else if(Station.shapesType=='d') {
  232 + $('#radiusGroup').hide();
  233 + $('#shapesTypeSelect').val('多边形');
  234 + }
  235 + // 获取圆形半径元素,并添加值
  236 + $('#radiusInput').val(Station.radius);
  237 + // 是否撤销
  238 + $('#destroySelect').val(0);
  239 +
  240 + var initzdlyP = {'lineId':Line.id,'destroy':0,'direction':Line.dir};
  241 + initSelect(initzdlyP);
  242 + });
  243 + });
  244 + // 站点序号值改变事件
  245 + $('#stationrouteSelect').on('change',function() {
  246 + var stationRValue = $('#stationrouteSelect').val();
  247 + if(stationRValue=='请选择...') {
  248 + $('#stationMarkSelect').val('B');
  249 + }else {
  250 + var tempStr = stationRValue.split('_');
  251 + if(tempStr[1] == 'E') {
  252 + $('#stationMarkSelect').val('E');
  253 + }else {
  254 + $('#stationMarkSelect').val('Z');
  255 + }
  256 + }
  257 + });
  258 + // 获取表单元素
  259 + var form = $('#add_station_form');
  260 + // 获取错误提示信息元素
  261 + var error = $('.alert-danger', form);
  262 + //提交
  263 + $('#addStationButton').on('click', function() {
  264 + // 表单提交
  265 + form.submit();
  266 + });
  267 + // 表单验证
  268 + form.validate({
  269 + errorElement : 'span',
  270 + errorClass : 'help-block help-block-error',
  271 + focusInvalid : true,
  272 + rules : {
  273 + 'stationName' : {required : true,maxlength : 50,},// 站点名称 必填项
  274 + 'stationCod': {required : true,},// 站点编码 必填项 必须输入合法的数字(负数,小数)。
  275 + 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
  276 + 'stationRouteCode' : {isStart : true},// 站点序号
  277 + 'stationMark' : {required : true,},// 站点类型 必填项.
  278 + 'bJwpoints' : {required : true,},// 经纬度坐标点 必填项.
  279 + 'shapesType' : {required : true,},// 几何图形类型 必填项.
  280 + 'radius' : {required : true,},// 几何图形类型 必填项.
  281 + 'destroy' : {required : true,},// 是否撤销 必填项.
  282 + 'toTime' : {number : true},// 到站时间 必须输入合法的数字(负数,小数)。
  283 + 'distances' : {number : true},// 到站距离 必须输入合法的数字(负数,小数)。
  284 + 'descriptions' : {maxlength: 150}// 描述与说明 // 描述与说明
  285 +
  286 + },
  287 + invalidHandler : function(event, validator) {
  288 + error.show();
  289 + App.scrollTo(error, -200);
  290 + },
  291 + highlight : function(element) {
  292 + $(element).closest('.form-group').addClass('has-error');
  293 + },
  294 + unhighlight : function(element) {
  295 + $(element).closest('.form-group').removeClass('has-error');
  296 + },
  297 + success : function(label) {
  298 + label.closest('.form-group').removeClass('has-error');
  299 + },
  300 + submitHandler : function(f) {
  301 + var params = form.serializeJSON();
  302 + error.hide();
  303 + if(params.shapesType=='圆形')
  304 + params.shapesType='r';
  305 + else if(params.shapesType=='多边形')
  306 + params.shapesType='d';
  307 + if(params.stationRouteCode=='请选择...')
  308 + params.stationRouteCode='';
  309 + // 保存
  310 + ajaxd.stationCacheSave(params,function(data) {
  311 + if(data.status=='SUCCESS') {
  312 + // 弹出添加成功提示消息
  313 + layer.msg('添加成功...');
  314 + }else {
  315 + // 弹出添加失败提示消息
  316 + layer.msg('添加失败...');
  317 + }
  318 + closeMobleSetClean();
  319 + // 隐藏moble
  320 + hideMoble();
  321 + });
  322 + }
  323 + });
  324 + function initSelect(p){
  325 + ajaxd.getzdlyInfo(p,function(array) {
  326 + // 定义路段路由长度、渲染拼音检索下拉框格式数据.
  327 + var len_ = array.length,paramsD = new Array();
  328 + if(len_>0) {
  329 + paramsD.push({'id':'请选择...','text':'请选择...'});
  330 + // 遍历.
  331 + $.each(array, function(i, g){
  332 + // 判断.
  333 + if(g.name!='' || g.name != null) {
  334 + // 添加拼音检索下拉框格式数据数组.
  335 + paramsD.push({'id':g.stationRouteCode + '_' + g.stationMark + '_' + g.directions,
  336 + 'text':g.stationName + ' (' + g.stationRouteCode + ')' + ' --' + fun.dirdmToName(g.directions)});
  337 + }
  338 + });
  339 + $('#stationrouteSelect').empty();
  340 + // 初始化上一个路段拼音检索下拉框.
  341 + initPinYinSelect2($('#stationrouteSelect'),paramsD,function(selector) {
  342 + });
  343 + }
  344 + });
  345 + }
  346 + function closeMobleSetClean() {
  347 + // 清除地图覆盖物
  348 + addMap.clearMarkAndOverlays();
  349 + // 刷新站点列表
  350 + $('#station').click();
  351 + }
  352 + function hideMoble() {
  353 + // 隐藏mobal
  354 + $('#add_station_mobal').modal('hide');
  355 + }
  356 + // 当站点类型为中途站或者终点站时,上一站点为必填项!
  357 + $.validator.addMethod("isStart", function(value,element) {
  358 + var tel = false;
  359 + var stationMarkV = $('#stationMarkSelect').val();
  360 + var stationrouteSelectV = $('#stationrouteSelect').val();
  361 + if(stationMarkV =='B'){
  362 + tel = true;
  363 + return tel;
  364 + }else if(stationMarkV =='Z' || stationMarkV =='E'){
  365 + if(stationrouteSelectV!='' && stationrouteSelectV!='请选择...' && stationrouteSelectV!=null){
  366 + tel = true;
  367 + return tel;
  368 + }
  369 + }
  370 + return tel;
  371 + }, '当站点类型为中途站或者终点站时,上一站点为必填项!');
  372 + // 方向
  373 + $.validator.addMethod("dirIs", function(value,element) {
  374 + var tel = true;
  375 + var stationMarkV = $('#stationdirSelect').val();
  376 + if(stationMarkV!=Line.dir){
  377 + tel = false;
  378 + }
  379 + return tel;
  380 + }, '方向必须一致!');
  381 +});
  382 +</script>
0 383 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/addstation_select.html 0 → 100644
  1 +<!-- 选择站点新增方式 -->
  2 +<div class="modal fade" id="addstation_select_mobal" tabindex="-1" role="basic" aria-hidden="true">
  3 + <div class="modal-dialog">
  4 + <div class="modal-content">
  5 + <div class="modal-header">
  6 + <button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
  7 + <h4 class="modal-title">站点新增方式
  8 + <i class="fa fa-question-circle tipso-animation" style="color: rgba(158, 158, 158, 0.49);"></i>
  9 + </h4>
  10 + </div>
  11 + <div class="modal-body">
  12 + <form class="form-horizontal" action="/" method="post" id="formBootbox" role="form">
  13 + <div class="alert alert-danger display-hide" id="requiredname">
  14 + <button class="close" data-close="alert"></button>
  15 + 站点名称为必填项
  16 + </div>
  17 + <!-- 站点名称 -->
  18 + <div class="form-group" id="formRequ">
  19 + <label class="col-md-3 control-label"><span class="required"> * </span>站点名称:</label>
  20 + <div class="col-md-9">
  21 + <input type="text" class="form-control input-medium" id="stationNamebootboxInput" name="stationNamebootbox">
  22 + </div>
  23 + </div>
  24 + <!-- 新增方式 -->
  25 + <div class="form-group">
  26 + <label class="col-md-3 control-label">新增方式:</label>
  27 + <div class="col-md-9">
  28 + <div class="icheck-list">
  29 + <label>
  30 + <input type="radio" class="icheck" name="baseRes" value=0 checked> 系统生成
  31 + </label>
  32 + <label >
  33 + <input type="radio" class="icheck" name="baseRes" value=1 > 手动添加
  34 + </label>
  35 + </div>
  36 + </div>
  37 + </div>
  38 + </form>
  39 + </div>
  40 + <div class="modal-footer">
  41 + <button type="button" class="btn default" data-dismiss="modal">取消</button>
  42 + <button type="button" class="btn btn-primary" id="addSelectnextButton">下一步</button>
  43 + </div>
  44 + </div>
  45 + </div>
  46 +</div>
  47 +<script type="text/javascript">
  48 +$('#addstation_select_mobal').on('AddSelectMobal.show', function(e,map_,drw,ajaxd_,editRoute,fun){
  49 + var stationObj = {};
  50 + // 加载显示mobal
  51 + $('#addstation_select_mobal').modal({show : true,backdrop: 'static', keyboard: false});
  52 + setTimeout(function(){
  53 + var offsetY = $('.modal-dialog').offset().top-3 ,
  54 + offsetX = $('.modal-dialog').offset().left-10 ;
  55 + $('.tipso-animation').tipso({
  56 + speed : 100,
  57 + background : '#0ed0e8',
  58 + color : '#ffffff',
  59 + position :'right',
  60 + width : 390,
  61 + delay : 400,
  62 + animationIn : 'bounceIn',
  63 + animationOut : 'bounceOut',
  64 + offsetX : -(offsetX),
  65 + offsetY : -(offsetY),
  66 + content :'<span style="display:block; float:left;font-size:x-small;line-height:10px">A)系统生成:根据站点名称自动生成以150米为半径范围的圆.</span></br>'+
  67 + '<span style="display:block; float:left;font-size:x-small">B)手动添加:手动在地图上画出站点范围,然后双击鼠标右键保存.</span>',
  68 +
  69 + });
  70 + $('.tipso-animation').tipso('show');
  71 + setTimeout(function(){$('.tipso-animation').tipso('hide');},4000);
  72 + },500);
  73 + // 获取表单元素
  74 + var form = $('#formBootbox');
  75 + // 错误提示元素
  76 + var requiredname = $('#requiredname', form);
  77 + // 下一步点击事件
  78 + $('#addSelectnextButton').on('click', function() {
  79 + // 表单提交
  80 + form.submit();
  81 + });
  82 + // 表单验证
  83 + form.validate({
  84 + errorElement : 'span',
  85 + errorClass : 'help-block help-block-error',
  86 + focusInvalid : false,
  87 + rules : {
  88 + 'stationNamebootbox' : {required : true,maxlength : 50}// 必填项 最大长度为50
  89 + },
  90 + invalidHandler : function(event, validator) {
  91 + requiredname.show();
  92 + App.scrollTo(requiredname, -200);
  93 + },
  94 + highlight : function(element) {
  95 + $(element).closest('.form-group').addClass('has-error');
  96 + },
  97 + unhighlight : function(element) {
  98 + $(element).closest('.form-group').removeClass('has-error');
  99 + },
  100 + success : function(label) {
  101 + label.closest('.form-group').removeClass('has-error');
  102 + },
  103 + submitHandler : function(f) {
  104 + // 隐藏错误提示
  105 + requiredname.hide();
  106 + // 表单序列化
  107 + var params = form.serializeJSON();
  108 + var stationName = params.stationNamebootbox;
  109 + // 获取新增站点方式
  110 + var baseRes = params.baseRes;
  111 + /** 设置新增站点对象站点名称属性值 @param:<stationName:站点名称)> */
  112 + stationObj.stationNamebootbox = stationName;
  113 + // 系统生成
  114 + if(baseRes == 0) {
  115 + /** 根据站点位置获取坐标 @parma:<stationName:站点名称;callback:返回函数> */
  116 + map_.localSearchFromAdreesToPoint(stationName,function(Points) {
  117 + if(Points) {
  118 + /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  119 + stationObj.bJwpoints = Points;
  120 + /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  121 + stationObj.shapesType = 'r';
  122 + /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  123 + stationObj.radius = 100;
  124 + /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  125 + stationObj.bPolygonGrid = '';
  126 + // 以藏站点新增方式mobal
  127 + $('#addstation_select_mobal').modal('hide');
  128 + // 加载add页面
  129 + $.get('addstation.html', function(m){
  130 + $(pjaxContainer).append(m);
  131 + $('#add_station_mobal').trigger('AddStationMobal.show', [map_,ajaxd_,stationObj,editRoute,fun]);
  132 + });
  133 + }else {
  134 + // 返回坐标为空
  135 + layer.confirm('【系统无法生成,请选择其他方式新增】', {btn : [ '返回' ],icon: 3, title:'提示' }, function(index){
  136 + layer.close(index);
  137 + });
  138 + }
  139 + });
  140 + }else if(baseRes==1) {
  141 + // 关闭按钮事件
  142 + fun.addAChangeCssAddDisabled();
  143 + map_.clearMarkAndOverlays();
  144 + // 以藏站点新增方式mobal
  145 + $('#addstation_select_mobal').modal('hide');
  146 + // 打开绘制工具
  147 + $('.leftUtils').removeClass('hidden');
  148 + drw.openPointDrawingManager(stationObj,'add');
  149 + drw.drawingManagerClose();
  150 + map_.localtionPoint(stationName);
  151 + }
  152 + }
  153 + });
  154 +});
  155 +</script>
0 156 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/css/bmap_base.css
... ... @@ -12,6 +12,17 @@ html,body{
12 12 overflow:hidden;
13 13 }
14 14  
  15 +/* 绘画工具栏 */
  16 +.leftUtils{
  17 + position: absolute;
  18 + padding-right: 100px;
  19 + width: 100%;
  20 + height: 40px;
  21 + z-index: 9999;
  22 + padding-top: 7px;
  23 + top: 40px;
  24 +}
  25 +
15 26 .caption {
16 27 color: white;
17 28 font-size: 18px;
... ... @@ -190,12 +201,10 @@ ul li a:hover:not(.active) {
190 201 .radio_label {
191 202 display:block;
192 203 color: white;
193   - float: left;
194 204 cursor: pointer;
195 205 margin-left: 50px;
196 206 font-size: 20px;
197 207 margin-top: 5px;
198   - text-align: center;
199 208 }
200 209 .radioclass {
201 210 margin-top: 6px !important;
... ... @@ -207,7 +216,4 @@ ul li a:hover:not(.active) {
207 216 }
208 217 .on {
209 218 background-position: 0 0;
210   -}
211   -
212   -
213   -
  219 +}
214 220 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/editRoute.html
... ... @@ -4,7 +4,7 @@
4 4  
5 5 <div class="modal-dialog">
6 6  
7   - <div class="modal-content">
  7 + <div class="modal-content" >
8 8  
9 9 <div class="modal-header">
10 10 <button type="button" class="close" data-dismiss="modal"
... ... @@ -74,6 +74,7 @@
74 74 <div class="modal-footer">
75 75 <button type="button" class="btn default" data-dismiss="modal"
76 76 id="addMobalHiden">取消</button>
  77 +<!-- <button type="button" class="btn btn-primary hidden" id="referenceCurrentVersion">引用当前版本</button> -->
77 78 <button type="button" class="btn btn-primary" id="templateSaveData">提交数据</button>
78 79 </div>
79 80 </div>
... ... @@ -139,7 +140,7 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
139 140  
140 141 },
141 142 submitHandler : function(f) {
142   - // 隐藏手动规划弹出层
  143 + // 隐藏弹出层
143 144 $('#edit_route_mobal').modal('hide');
144 145 // 获取线路对象
145 146 var line = editRoute.getLineObj();
... ... @@ -151,6 +152,8 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
151 152 // 路线方向
152 153 var directionData = $("input[name='dirCheck']:checked").val();
153 154 editRoute.setLineDir(directionData);
  155 + // 设置线路对象生成方式
  156 + editRoute.setLineGenerationType('uploadGPS');
154 157 // 弹出正在加载层
155 158 var i = layer.load(2);
156 159 // 表单序列化
... ... @@ -256,6 +259,44 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
256 259 return bdEn;
257 260 }
258 261  
  262 + /** 引用当前版本站点和走向*/
  263 + /* $("#referenceCurrentVersion").on('click',function() {
  264 + // 获取线路对象
  265 + var line = editRoute.getLineObj();
  266 + // 路线方向
  267 + var direction = $("input[name='dirCheck']:checked").val();
  268 + // 设置线路对象方向
  269 + editRoute.setLineDir(direction);
  270 + // 设置线路对象生成方式
  271 + editRoute.setLineGenerationType('cite');
  272 + $.post("/station/referenceCurrentVersion",{'lineId' : line.id , 'directions' : direction},function(rd){
  273 + // 隐藏弹出层
  274 + $('#edit_route_mobal').modal('hide');
  275 + // 关闭弹出层
  276 + layer.closeAll();
  277 + if(rd.status='SUCCESS') {
  278 + // 清除地图覆盖物
  279 + map.clearMarkAndOverlays();
  280 + // 查询路段信息
  281 + var params = {};
  282 + params.lineId=line.id;
  283 + params.dir = direction;
  284 + // 查询路段信息
  285 + $get('/sectionroute/findCacheSection',params,function(data) {
  286 + // 在地图上画出线路走向
  287 + fun.linePanlThree(line.id,data,direction);
  288 + });
  289 + $('#route_show').removeClass('hidden');
  290 + $('#generationRoute_div').addClass('hidden');
  291 + // 刷新路段列表
  292 + $('#section').click();
  293 + layer.msg('引用当前版本成功!');
  294 + }else {
  295 + layer.msg('引用当前版本失败,请重新引用或选择其他方式!');
  296 + }
  297 + })
  298 + }); */
  299 +
259 300 function addSave(params,lineid,directionData) {
260 301 // 保存
261 302 $post("/station/cacheSave",params,function(rd) {
... ... @@ -276,14 +317,20 @@ $(&#39;#edit_route_mobal&#39;).on(&#39;editRouteMobal.show&#39;, function(e,transGPS,editRoute,m
276 317 }
277 318 // 清除地图覆盖物
278 319 map.clearMarkAndOverlays();
  320 + var params = {};
  321 + params.lineId = lineid;
  322 + params.dir = directionData;
279 323 // 查询路段信息
280   - $get('/sectionroute/findSectionCache',{'line.id_eq' : lineid , 'directions_eq' : directionData},function(data) {
  324 + $get('/sectionroute/findCacheSection',params,function(data) {
281 325 // 在地图上画出线路走向
282 326 fun.linePanlThree(lineid,data,directionData);
283 327 });
284   - $('#upload_show').removeClass('hidden');
285   - $('#upload').addClass('hidden');
286   - layer.msg('请先编辑路段,并保存!!!');
  328 + $('#route_show').removeClass('hidden');
  329 + $('#generationRoute_div').addClass('hidden');
  330 + // 刷新路段列表
  331 + $('#section').click();
  332 + layer.open({title: '友情提示'
  333 + ,content: '生成路线成功,生成的线路可能会有误差。请先单击路段,拖动编辑、然后双击保存!'});
287 334 }else {
288 335 layer.msg('生成路线失败!');
289 336 }
... ...
src/main/resources/static/pages/base/line/editsection.html
... ... @@ -156,8 +156,8 @@ $(&#39;#edit_section_mobal_cache&#39;).on(&#39;editSectionMobalCache_show&#39;, function(e, map_
156 156 var dir = Section.sectionrouteDirections;
157 157 var lineId = Section.sectionrouteLine;
158 158 // 获取路段号元素,并添加下拉属性值
159   - ajaxd.getStation(lineId,dir,function(treeData) {
160   - var array = treeData[0].children[1].children,paramsD =new Array();
  159 + ajaxd.getSectionCacheList(lineId,dir,function(array) {
  160 + paramsD =new Array();
161 161 var eq_scetionRouteCode = Section.sectionrouteCode;
162 162 paramsD.push({'id':'请选择...','text':'请选择...'});
163 163 // 遍历.
... ... @@ -175,7 +175,7 @@ $(&#39;#edit_section_mobal_cache&#39;).on(&#39;editSectionMobalCache_show&#39;, function(e, map_
175 175 // 初始化上一个路段拼音检索下拉框.
176 176 initPinYinSelect2($('#sectionrouteCodeSelect'),paramsD,function(selector) {
177 177 $('#sectionDirSelect').val('');// 设值方向.
178   - ajaxd.findUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) {
  178 + ajaxd.findCacheUpSectionRouteCode(lineId,dir,eq_scetionRouteCode,function(str) {
179 179 if(str.length>0){
180 180 var upStationRouteCode = str[0].sectionrouteCode;
181 181 $('#sectionrouteCodeSelect').select2('val',upStationRouteCode);
... ... @@ -196,10 +196,11 @@ $(&#39;#edit_section_mobal_cache&#39;).on(&#39;editSectionMobalCache_show&#39;, function(e, map_
196 196 map_.clearMarkAndOverlays();
197 197 /** 设置修改路段集合对象为空 */
198 198 section.setEitdSection({});
199   - // fun.editAChangeCssRemoveDisabled();
200   - $get('/sectionroute/findSectionCache',{'line.id_eq' : lineId , 'directions_eq' : dir},function(data) {
  199 + ajaxd.getSectionCacheList(lineId,dir,function(data) {
201 200 fun.linePanlThree(lineId,data,dir);
202 201 });
  202 + // 刷新路段列表
  203 + $('#section').click();
203 204 }
204 205  
205 206 // 编辑表单元素
... ... @@ -249,7 +250,7 @@ $(&#39;#edit_section_mobal_cache&#39;).on(&#39;editSectionMobalCache_show&#39;, function(e, map_
249 250 $post('/section/sectionCacheUpdate',params,function(resuntDate) {
250 251 if(resuntDate.status=='SUCCESS') {
251 252 // 弹出添加成功提示消息
252   - layer.msg('路段保存成功,将地图放到最大,用右击路段进行截取,确认截取完毕后提交!!!');
  253 + layer.msg('路段保存成功!');
253 254 }else {
254 255 // 弹出添加失败提示消息
255 256 layer.msg('路段保存失败,请重新编辑路段!!!');
... ...
src/main/resources/static/pages/base/line/editstation.html
... ... @@ -193,7 +193,7 @@
193 193 </div>
194 194 <script type="text/javascript">
195 195  
196   -$('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,station,fun){
  196 +$('#edit_station_mobal').on('editSelectMobal_show', function(e, map_,ajaxd,fun,station){
197 197 layer.closeAll();
198 198 fun.setFormValue(station);
199 199 var initzdlyP = {'lineId':station.stationRouteLine,'destroy':0,'direction':station.stationRouteDirections};
... ... @@ -228,7 +228,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,station,fun
228 228 'zdmc' : { required : true,maxlength : 50,},// 站点名称 必填项
229 229 'stationName' : { required : true,maxlength : 50,},// 站点名称 必填项
230 230 'stationCod': {required : true,},// 站点编码 必填项
231   - 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
  231 + 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
232 232 'stationRouteCode' : {isStart : true},// 站点序号
233 233 'stationMark' : {required : true},// 站点类型 必填项
234 234 'bJwpoints' : {required : true},// 经纬度坐标点 必填项
... ... @@ -265,8 +265,6 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,station,fun
265 265 if(resuntDate.status=='SUCCESS') {
266 266 // 弹出添加成功提示消息
267 267 layer.msg('修改成功...');
268   - /** 通知更新缓存区 */
269   - $.post('http://192.168.168.171:8800/transport_server/basic/refresh',function(rs){console.log(rs)})
270 268 }else {
271 269 // 弹出添加失败提示消息
272 270 layer.msg('修改失败...');
... ... @@ -279,7 +277,6 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,station,fun
279 277 // 站点序号值改变事件
280 278 $('#stationrouteSelect').on('change',function() {
281 279 var stationRValue = $('#stationrouteSelect').val();
282   - debugger
283 280 if(stationRValue=='请选择...') {
284 281 $('#stationMarkSelect').val('B');
285 282 }else {
... ... @@ -292,7 +289,7 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,station,fun
292 289 }
293 290 });
294 291 function initSelect(p){
295   - $get('/stationroute/cacheList',p,function(array) {
  292 + ajaxd.getzdlyInfo(p,function(array) {
296 293 // 定义路段路由长度、渲染拼音检索下拉框格式数据.
297 294 var len_ = array.length,paramsD = new Array();
298 295 if(len_>0) {
... ... @@ -326,10 +323,14 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,station,fun
326 323 params.lineId = station.stationRouteLine;
327 324 params.direction = station.stationRouteDirections;
328 325 params.stationRouteCode = station.stationRouteStationRouteCode;
329   - $get('/stationroute/findCacheUpStationRouteCode',params , function(str) {
330   - debugger
  326 + ajaxd.findCacheUpStationRouteCode(params, function(str) {
331 327 if(str.length>0){
332   - var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + station.stationRouteDirections;
  328 + var upStationRouteCode;
  329 + if (station.stationRouteStationMark == 'E') {
  330 + upStationRouteCode = str[0].stationRouteCode + '_' + 'E' + '_' + station.stationRouteDirections;
  331 + } else{
  332 + upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + station.stationRouteDirections;
  333 + }
333 334 $('#stationrouteSelect').select2('val',upStationRouteCode);
334 335 }else {
335 336 $('#stationrouteSelect').select2('val','请选择...');
... ...
src/main/resources/static/pages/base/line/editstation_select.html
... ... @@ -47,7 +47,7 @@
47 47 </div>
48 48 </div>
49 49 <script type="text/javascript">
50   -$('#editstation_select_mobal').on('editStationSelectMobal_show', function(e, map_,drw,stationRoute){
  50 +$('#editstation_select_mobal').on('editStationSelectMobal_show', function(e, map_,fun,drw,stationRoute){
51 51 // var sel = fun.getCurrSelNode(dir_);
52 52 // var Station = sel[0].original;
53 53 // 显示选择修改方式弹出层
... ... @@ -112,20 +112,20 @@ $(&#39;#editstation_select_mobal&#39;).on(&#39;editStationSelectMobal_show&#39;, function(e, map
112 112 var params = form.serializeJSON();
113 113 // 站点名称
114 114 stationRoute.zdmc = params.stationNamebootbox;
115   -
  115 + // 关闭按钮事件
  116 + fun.addAChangeCssAddDisabled();
116 117 if(params.editselect==0){
117   - layer.confirm('重绘站点,会修改站点编码,影响已做好的排班和线路文件。请谨慎使用,谢谢!', {
118   - btn: ['绘制','取消'] //按钮
119   - }, function(index){
120   - // 站点形状
121   - stationRoute.stationShapesType = 'd';
122   -
123   - map_.clearMarkAndOverlays();
124   - // 打开绘制工具
125   - drw.openPointDrawingManager(stationRoute);
126   - map_.localtionPoint(stationRoute.zdmc);
127   - layer.close(index);
128   - });
  118 + // 站点形状
  119 + stationRoute.stationShapesType = 'd';
  120 +
  121 + map_.clearMarkAndOverlays();
  122 + // 打开绘制工具
  123 + drw.openPointDrawingManager(stationRoute,'edit');
  124 + $('.leftUtils').removeClass('hidden');
  125 + $('.leftUtils').addClass('active');
  126 + drw.drawingManagerClose();
  127 + map_.localtionPoint(stationRoute.zdmc);
  128 + layer.close(index);
129 129 }else if(params.editselect==1){
130 130 // 弹出添加失败提示消息,2秒关闭(如果不配置,默认是3秒)
131 131 var mindex = layer.msg('编辑完图形后,请双击图形区域保存',{ offset: '126px',
... ...
src/main/resources/static/pages/base/line/js/drawingManager.js
... ... @@ -40,87 +40,97 @@ var DrawingManagerObj = function () {
40 40  
41 41 },
42 42  
43   - openPointDrawingManager : function(objStation) {
  43 + openPointDrawingManager : function(objStation, type) {
44 44  
45 45 // 打开鼠标绘画工具
46   - drawingManager.open();
47   -
48   - // 设置属性
49   - drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
  46 + DrawingManagerObj.drawingManagerOpen();
50 47  
51 48 // 添加绘画完成事件
52 49 drawingManager.addEventListener('polygoncomplete', function(e) {
53   -
54   - drawingManager.close;
  50 + // 关闭绘画
  51 + DrawingManagerObj.drawingManagerClose();
  52 + // 隐藏绘画工具栏
  53 + $('.leftUtils').addClass('hidden');
55 54  
56 55 if (e.getPath().length <= 2) {
57   -
58 56 WorldsBMapLine.clearMarkAndOverlays();
59   - openPointDrawingManager();
60 57  
61 58 // 弹出提示消息
62   - layer.msg('坐标点不能小于等于两个,请重新绘画!');
63   -
64   - return;
65   -
66   - }else {
  59 + layer.msg('坐标点不能小于三个,请重新操作!');
67 60  
  61 + }else {
68 62 // 获取编辑的多边形对象
69   - var edit_pointE = e;
  63 + var pointE = e;
70 64  
71   - var edit_bPloygonGrid = "";
  65 + var bPloygonGrid = "";
72 66  
73   - var editPolyGonLen_ = edit_pointE.getPath().length;
  67 + var editPolyGonLen_ = pointE.getPath().length;
74 68  
75 69 for(var k =0;k<editPolyGonLen_;k++) {
76 70  
77 71 if(k==0) {
78 72  
79   - edit_bPloygonGrid = edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat;
  73 + bPloygonGrid = pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat;
80 74  
81 75 }else {
82 76  
83   - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[k].lng + ' ' + edit_pointE.getPath()[k].lat;
  77 + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[k].lng + ' ' + pointE.getPath()[k].lat;
84 78  
85 79 }
86 80  
87 81 }
88 82  
89   - edit_bPloygonGrid = edit_bPloygonGrid + ',' + edit_pointE.getPath()[0].lng + ' ' + edit_pointE.getPath()[0].lat;
90   -
  83 + bPloygonGrid = bPloygonGrid + ',' + pointE.getPath()[0].lng + ' ' + pointE.getPath()[0].lat;
91 84 // 多边形中心点
92   - var centre_points = edit_pointE.getBounds().getCenter().lng + ' ' + edit_pointE.getBounds().getCenter().lat;
93   -
94   - /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
95   - objStation.stationBJwpoints = centre_points;
96   -
97   - /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
98   - objStation.stationShapesType = 'd';;
99   -
100   - /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
101   - objStation.stationRadius = '';
102   -
103   - /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
104   - objStation.stationBPolygonGrid = edit_bPloygonGrid;
105   -
106   - $.get('editstation.html', function(m){
107   -
108   - $(pjaxContainer).append(m);
109   -
110   - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMapLine,objStation,PublicFunctions]);
111   -
112   - });
  85 + var centre_points = pointE.getBounds().getCenter().lng + ' ' + pointE.getBounds().getCenter().lat;
  86 + if(type == 'edit') {
  87 + /** 设置修改站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  88 + objStation.stationBJwpoints = centre_points;
  89 + /** 设置修改站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  90 + objStation.stationShapesType = 'd';;
  91 + /** 设置修改站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  92 + objStation.stationRadius = '';
  93 + /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  94 + objStation.stationBPolygonGrid = bPloygonGrid;
  95 + $.get('editstation.html', function(m){
  96 +
  97 + $(pjaxContainer).append(m);
  98 +
  99 + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMapLine, MapGetAjaxData, PublicFunctions, objStation]);
  100 +
  101 + });
  102 + } else if(type == 'add') {
  103 + /** 设置新增站点集合对象站点中心点百度坐标属性值 @param:<bJwpoints:中心点百度坐标) */
  104 + objStation.bJwpoints = centre_points;
  105 + /** 设置新增站点集合对象范围图形类型属性值 @param:<shapesType:范围图形类型) */
  106 + objStation.shapesType = 'd';
  107 + /** 设置新增站点集合对象圆形半径属性值 @param:<radius:圆形半径) */
  108 + objStation.radius = '';
  109 + /** 设置新增站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
  110 + objStation.bPolygonGrid = bPloygonGrid;
  111 + // 加载add页面
  112 + $.get('addstation.html', function(m){
  113 + $(pjaxContainer).append(m);
  114 + $('#add_station_mobal').trigger('AddStationMobal.show', [WorldsBMapLine, MapGetAjaxData, objStation, EditRoute, PublicFunctions]);
  115 + });
  116 + }
113 117  
114 118 }
115   -
  119 + // 打开按钮事件
  120 + PublicFunctions.editAChangeCssRemoveDisabled();
116 121 });
117 122  
118 123 },
119   -
120   - closeDrawingManager : function() {
121   -
  124 + // 打开绘画工具
  125 + drawingManagerOpen : function() {
  126 + // 打开鼠标绘画工具
  127 + drawingManager.open();
  128 + // 设置属性
  129 + drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
  130 + },
  131 + drawingManagerClose : function() {
122 132 drawingManager.close();
123   - }
  133 + },
124 134 }
125 135  
126 136 return draMangerObj;
... ...
src/main/resources/static/pages/base/line/js/editRoute.js
... ... @@ -12,10 +12,23 @@ var EditRoute = function(){
12 12 setLineId : function(id) {
13 13 line.id = id;
14 14 },
  15 + getLineId : function() {
  16 + return line.id;
  17 + },
15 18 setLineDir : function(dir) {
16 19  
17 20 line.dir = dir;
18 21 },
  22 + getLineDir : function() {
  23 +
  24 + return line.dir;
  25 + },
  26 + setLineGenerationType : function(generationType) {// 生成类型(uploadGPS:上传gps/cite:引用当前版本)
  27 + line.generationType = generationType;
  28 + },
  29 + getLineGenerationType : function() {// 生成类型(uploadGPS:上传gps/cite:引用当前版本)
  30 + return line.generationType;
  31 + },
19 32 };
20 33  
21 34 return editRoute;
... ...
src/main/resources/static/pages/base/line/js/line-add-form.js
... ... @@ -246,7 +246,7 @@ $(function(){
246 246 if(result.status=='SUCCESS') {
247 247  
248 248 // 弹出添加成功提示消息
249   - layer.msg('添加成功...');
  249 + layer.msg('添加成功,并已自动为您生成线路原始版本,可以在线路版本信息下查看!', {time: 7000});
250 250  
251 251 } else if(result.status=='ERROR') {
252 252  
... ...
src/main/resources/static/pages/base/line/js/map-ajax-getdata.js 0 → 100644
  1 +/**
  2 + * MapGetAjaxData :ajax异步请求
  3 + *
  4 + * - - - - - -》 getSectionCacheList :获取路段列表
  5 + *
  6 + * - - - - - -》 getzdlyInfo :获取站点列表
  7 + *
  8 + * - - - - - -》 getLikeStationName :查询是否有已存在站点名称
  9 + *
  10 + * - - - - - -》 getStationCode:查询站点编码
  11 + *
  12 + * - - - - - -》 findCacheUpStationRouteCode:查询上一个缓存站点的序号
  13 + *
  14 + * - - - - - -》 findCacheUpSectionRouteCode:查询上一个缓存路段的序号
  15 + *
  16 + * - - - - - -》 stationCacheSave:新增缓存站点保存
  17 + *
  18 + * - - - - - -》 stationCacheUpdate:站点缓存更新
  19 + *
  20 + * - - - - - -》 sectionUpdate : 编辑线路走向保存
  21 + *
  22 + * - - - - - -》 getIdLineName:获取线路名称
  23 + */
  24 +
  25 +var MapGetAjaxData = function(){
  26 +
  27 + var ajaxData = {
  28 + // 获取路段列表
  29 + getSectionCacheList : function(lineId,dir,callback) {
  30 + $get('/sectionroute/findCacheSection',{'lineId' : lineId , 'dir' : dir},function(resultdata) {
  31 + callback && callback(resultdata);
  32 + });
  33 + },
  34 + getzdlyInfo : function(params,callback) {
  35 + $get('/stationroute/cacheList',params,function(array) {
  36 + callback && callback(array);
  37 + });
  38 + },
  39 + // 查询是否有已存在站点名称
  40 + getLikeStationName : function (stationName,callback) {
  41 + $get('/station/all', {stationName_eq: stationName}, function(array){
  42 + callback && callback(array);
  43 + });
  44 + },
  45 + // 查询站点编码
  46 + getStationCode : function(callback) {
  47 + $get('/station/getStationCode',null,function(stationCode) {
  48 + if(stationCode>0) {
  49 + callback && callback(stationCode);
  50 + }
  51 + });
  52 + },
  53 + findCacheUpStationRouteCode : function(params,callback) {
  54 + $get('/stationroute/findCacheUpStationRouteCode',params,function(result) {
  55 + callback && callback(result);
  56 + });
  57 + },
  58 + findCacheUpSectionRouteCode : function(lineId,dir,sectionRouteCode,callback) {
  59 + $get('/sectionroute/findCacheUpSectionRouteCode',{'lineId' : lineId , 'direction' : dir, 'sectionRouteCode':sectionRouteCode},function(result) {
  60 + callback && callback(result);
  61 + });
  62 + },
  63 + // 新增缓存站点保存
  64 + stationCacheSave : function(station,callback) {
  65 + $post('/station/stationCacheSave',station,function(data) {
  66 + debugger
  67 + callback && callback(data);
  68 + });
  69 + },
  70 + // 缓存站点更新
  71 + stationCacheUpdate : function(station,callback) {
  72 + $post('/station/stationCacheUpdate',station,function(data) {
  73 + callback && callback(data);
  74 + });
  75 + },
  76 + // 获取线路名称
  77 + getIdLineName : function (id,callback) {
  78 +
  79 + $get('/line/' + id ,null, function(result){
  80 +
  81 + callback && callback(result);
  82 +
  83 + });
  84 +
  85 + },
  86 + }
  87 + return ajaxData;
  88 +}();
0 89 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/js/line-map-function.js renamed to src/main/resources/static/pages/base/line/js/map-function.js
... ... @@ -3,7 +3,7 @@ var PublicFunctions = function () {
3 3 /** 初始化线路标题与ID */
4 4 setTiteText : function(lineId) {
5 5 // 根据线路ID获取线路名称
6   - GetAjaxData.getIdLineName(lineId,function(data) {
  6 + MapGetAjaxData.getIdLineName(lineId,function(data) {
7 7 // 定义线路名称
8 8 var lineNameV = data.name;
9 9 $('.portlet-title .caption').text(lineNameV);
... ... @@ -40,7 +40,7 @@ var PublicFunctions = function () {
40 40 // 版本号
41 41 $('#versionsInput').val(Section.versions);
42 42 // 是否撤销
43   - $('#destroySelect').val(Section.destroy);
  43 + $('#destroySelect').val(0);
44 44 // 描述/说明
45 45 $('#descriptionsTextarea').val(Section.descriptions);
46 46 },
... ... @@ -113,7 +113,6 @@ var PublicFunctions = function () {
113 113 /** 在地图上画点 @param:<point_center:中心坐标点> */
114 114 WorldsBMapLine.drawingUpStationPoint(point_center,stationName,s+1);
115 115 }
116   -
117 116 }
118 117 // 路段数据长度
119 118 var dataLen = data.length;
... ...
src/main/resources/static/pages/base/line/js/map.js
... ... @@ -206,7 +206,50 @@ var WorldsBMapLine = function () {
206 206 })();
207 207  
208 208 },
209   - // 在地图上画出上行线路走向
  209 + drawingSection: function(data){
  210 + /** 获取站点路由信息 @param:<Line.id:线路Id;0:上行> @return:<resultdata:站点路由数据> */
  211 + WorldsBMapLine.clearMarkAndOverlays();
  212 + // 编辑路段数据
  213 + if(data) {
  214 + // 地图折线坐标点集合
  215 + var polylineArray = [];
  216 + // 获取路段折线坐标字符串
  217 + var sectionBsectionVectorStr = data.sectionBsectionVector;
  218 + if(sectionBsectionVectorStr==null) {
  219 + return;
  220 + }
  221 + // 切割段折线坐标字符串
  222 + var tempStr = sectionBsectionVectorStr.substring(11,sectionBsectionVectorStr.length-1);
  223 + // 分割折线坐标字符串
  224 + var lineArray = tempStr.split(',');
  225 + for(var i = 0;i<lineArray.length;i++) {
  226 + polylineArray.push(new BMap.Point(lineArray[i].split(' ')[0],lineArray[i].split(' ')[1]));
  227 + }
  228 + var index = parseInt(polylineArray.length/2);
  229 + var center = polylineArray[index];
  230 + /** 在地图上画出线路走向 @param:<polylineArray:地图折线坐标点集合;resultdata:站点路由数据> */
  231 + WorldsBMapLine.drawingUpline(polylineArray,center);
  232 + /** 在地图上画点 @param:<point_center:中心坐标点> */
  233 + WorldsBMapLine.drawingUpStationPoint(center,data.sectionName,1);
  234 + }
  235 + },
  236 + // 在地图上画出上行线路走向(单路段)
  237 + drawingUpline : function (polylineArray,polyline_center,data) {
  238 + /*WorldsBMap.clearMarkAndOverlays();*/
  239 + polyUpline = '';
  240 + // 创建线路走向
  241 + polyUpline = new BMap.Polyline(polylineArray, {strokeColor : "blue",strokeWeight : 6,strokeOpacity : 0.5});
  242 + // polyUpline.data = data;
  243 + // 把折线添加到地图上
  244 + mapBValue.addOverlay(polyUpline);
  245 + var PanOptions_ ={noAnimation :true};
  246 + mapBValue.reset();
  247 + mapBValue.panTo(polyline_center,PanOptions_);
  248 + mapBValue.panBy(500,-510,PanOptions_);
  249 + mapBValue.setZoom(14);
  250 + },
  251 +
  252 + // 在地图上画出上行线路走向(多路段)
210 253 drawingUpline01 : function (polylineArray,polyline_center,data) {
211 254 var polyUpline01 = 'polyline' + '_' + data.sectionrouteId;
212 255 // 创建线路走向
... ... @@ -252,7 +295,7 @@ var WorldsBMapLine = function () {
252 295 // 加载修改路段弹出层mobal页面
253 296 $.get('editsection.html', function(m){
254 297 $(pjaxContainer).append(m);
255   - $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [WorldsBMapLine,GetAjaxData,EditSectionObj,PublicFunctions]);
  298 + $('#edit_section_mobal_cache').trigger('editSectionMobalCache_show', [WorldsBMapLine,MapGetAjaxData,EditSectionObj,PublicFunctions]);
256 299 });
257 300 // 打开按钮事件
258 301 PublicFunctions.editAChangeCssRemoveDisabled();
... ... @@ -300,9 +343,12 @@ var WorldsBMapLine = function () {
300 343 }
301 344 WorldsBMapLine.setIsCutSection(true);
302 345 }
303   - var markerMenu=new BMap.ContextMenu();
304   - markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01)));
305   - polyUpline01.addContextMenu(markerMenu);
  346 + // 路段生成类型位gps上传时才开启右击事件
  347 + if(EditRoute.getLineGenerationType() == 'uploadGPS') {
  348 + var markerMenu=new BMap.ContextMenu();
  349 + markerMenu.addItem(new BMap.MenuItem('切路段',editSection.bind(polyUpline01)));
  350 + polyUpline01.addContextMenu(markerMenu);
  351 + }
306 352  
307 353  
308 354 var PanOptions_ ={noAnimation :true};
... ... @@ -387,7 +433,7 @@ var WorldsBMapLine = function () {
387 433 mapBValue.addOverlay(marker);
388 434 },
389 435  
390   - // 根据站点坐标匹配库中的公交站点(手动规划)
  436 + // 根据站点坐标匹配库中的公交站点
391 437 stationsPointsToLibraryPoint : function(arra,callback) {
392 438 // 获取长度
393 439 var len = arra.length;
... ... @@ -710,9 +756,6 @@ var WorldsBMapLine = function () {
710 756 mapBValue.panTo(point,PanOptions_);
711 757  
712 758 mapBValue.panBy(10,-200,PanOptions_);
713   -
714   - // 关闭按钮事件
715   - PublicFunctions.addAChangeCssAddDisabled();
716 759  
717 760 // 编辑圆监听事件
718 761 circle.addEventListener('dblclick',function() {
... ... @@ -740,7 +783,7 @@ var WorldsBMapLine = function () {
740 783  
741 784 $(pjaxContainer).append(m);
742 785  
743   - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMapLine,objStation,PublicFunctions]);
  786 + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMapLine,MapGetAjaxData,PublicFunctions,objStation]);
744 787  
745 788 });
746 789  
... ... @@ -748,7 +791,7 @@ var WorldsBMapLine = function () {
748 791 PublicFunctions.editAChangeCssRemoveDisabled();
749 792 });
750 793  
751   - // 编辑多
  794 + // 编辑多
752 795 }else if(stationShapesType =='d') {
753 796  
754 797 // 清除地图覆盖物
... ... @@ -808,9 +851,6 @@ var WorldsBMapLine = function () {
808 851  
809 852 // 将地图在水平位置上移动x像素,垂直位置上移动y像素。
810 853 mapBValue.panBy(10,-150,PanOptions_);
811   -
812   - // 关闭按钮事件(图形编辑中)
813   - PublicFunctions.addAChangeCssAddDisabled();
814 854  
815 855 // 添加多变行编辑事件
816 856 polygon.addEventListener('dblclick',function(e) {
... ... @@ -857,14 +897,14 @@ var WorldsBMapLine = function () {
857 897  
858 898 $(pjaxContainer).append(m);
859 899  
860   - $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMapLine,objStation,PublicFunctions]);
  900 + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMapLine,MapGetAjaxData,PublicFunctions,objStation]);
861 901  
862 902 });
863 903  
  904 + // 打开按钮事件
  905 + PublicFunctions.editAChangeCssRemoveDisabled();
864 906 });
865 907  
866   - // 打开按钮事件
867   - PublicFunctions.editAChangeCssRemoveDisabled();
868 908 }
869 909 }
870 910 },
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -244,7 +244,7 @@
244 244 闵行公司
245 245 {{/if}}
246 246 </td>
247   -<td>
  247 + <td>
248 248 {{if obj.company == '55'}}
249 249  
250 250 {{if obj.brancheCompany == '1'}}
... ... @@ -295,6 +295,8 @@
295 295 南汇维修公司
296 296 {{else if obj.brancheCompany == '5'}}
297 297 南汇公司
  298 + {{else if obj.brancheCompany == '6'}}
  299 + 航头枢纽站
298 300 {{/if}}
299 301  
300 302 {{/if}}
... ...
src/main/resources/static/pages/base/line/map.html
... ... @@ -3,44 +3,75 @@
3 3 <div class="portlet-body">
4 4 <!-- 地图 -->
5 5 <div id="bmap_basic" class="bmaps"></div>
  6 + <!-- 绘画工具栏 -->
  7 + <div class="leftUtils hidden">
  8 + <div class="btn-group" style="left: 100px;">
  9 + <a class="btn btn-sm green-seagreen dropdown-toggle" style="width: 98px;" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> 绘制工具
  10 + <i class="fa fa-angle-down"></i>
  11 + </a>
  12 + <ul class="dropdown-menu pull-right" style="min-width:100px">
  13 + <li>
  14 + <a href="javascript:;" id="oppenDrawingManager"><i class="fa fa-pencil"></i> 打开 </a>
  15 + </li>
  16 + <li>
  17 + <a href="javascript:;" id = "closeDrawingManager"> <i class="fa fa-reply"></i> 关闭 </a>
  18 + </li>
  19 + </ul>
  20 + </div>
  21 + </div>
6 22 <!-- 右边显示栏 -->
7 23 <div class="cut-section" id="scrllmouseEvent_div">
8 24 <div class="portlet-title">
9 25 <div class="caption">途径站点</div>
10 26 </div>
11 27 <div class="portlet-body">
12   - <div class="table-toolbar" style="text-align: center;" id="upload">
13   - <button class="btn btn-circle blue" id="uploadRoute">
  28 + <div class="table-toolbar" style="text-align: center;" id="generationRoute_div">
  29 + <button class="btn btn-circle blue" id="generationRoute">
14 30 <i class="fa fa-plus"></i> 生成路线
15 31 </button>
16 32 </div>
17   - <div class="portlet-body hidden" id="upload_show">
  33 + <!-- 生成走向跳转的div -->
  34 + <div class="portlet-body hidden" id="route_show">
18 35 <div>
19 36 <ul class="nav nav-pills nav-justified steps">
20 37 <li class="active">
21 38 <a id="section"><span>路段</span></a>
22 39 </li>
23 40 <li>
24   - <a id="station"><span>站点</span></a>
  41 + <a class="station" id="station"><span>站点</span></a>
25 42 </li>
26 43 </ul>
27 44 </div>
28 45 <div id="section_list_div" class="active" style="margin: 5px;">
29   - <div class="defeat-scroll"
30   - style="height: 400px; overflow-y: auto; ">
31   - <table class="table table-bordered table-hover table-checkable "
32   - id="section_table" style="color: white;">
33   - <thead>
34   - <tr role="row" class="heading">
35   - <th>截取路段的名称</th>
36   - </tr>
37   - </thead>
38   - <tbody></tbody>
39   - </table>
  46 + <!-- 上传gps生成路段div -->
  47 + <div id="gpsSection">
  48 + <div class="defeat-scroll"
  49 + style="height: 400px; overflow-y: auto; ">
  50 + <table class="table table-bordered table-hover table-checkable "
  51 + id="section_table" style="color: white;">
  52 + <thead>
  53 + <tr role="row" class="heading">
  54 + <th>截取路段的名称</th>
  55 + </tr>
  56 + </thead>
  57 + <tbody></tbody>
  58 + </table>
  59 + </div>
  60 + <div class="table-toolbar">
  61 + <a class="btn btn-circle blue" id="Undo">撤销切点</a>
  62 + <a class="btn btn-circle blue" id="cutSection">提交选项</a>
  63 + </div>
40 64 </div>
41   - <div class="table-toolbar">
42   - <a class="btn btn-circle blue" id="Undo">撤销切点</a>
43   - <a class="btn btn-circle blue" id="cutSection">提交选项</a>
  65 + <!-- 引用当前版本路段div -->
  66 + <div id="citeSection">
  67 + <div class="defeat-scroll"
  68 + style="height: 400px; overflow-y: auto; ">
  69 + </div>
  70 + <div class="table-toolbar">
  71 + <a class="btn btn-circle blue" id="findSection">查看路段</a>
  72 + <a class="btn btn-circle blue" id="addSection">添加路段</a>
  73 + <a class="btn btn-circle blue" id="submitOptions">提交选项</a>
  74 + </div>
44 75 </div>
45 76 </div>
46 77 <div id="station_list_div" class="hidden">
... ... @@ -48,6 +79,7 @@
48 79 style="height: 400px; overflow-y: auto; ">
49 80 </div>
50 81 <div class="table-toolbar">
  82 + <a class="btn btn-circle blue" id="addStation">添加站点</a>
51 83 <a class="btn btn-circle blue" id="findStation">查看站点</a>
52 84 <a class="btn btn-circle blue" id="updateStation">修改站点</a>
53 85 </div>
... ... @@ -81,6 +113,8 @@ $(function(){
81 113 var direction = 0;
82 114 // 站点Map
83 115 var stationRouteMap = new Map();
  116 + // 路段Map
  117 + var sectionRouteMap = new Map();
84 118 // 如果线路ID不为空
85 119 if(id) {
86 120 var styleOptions = {
... ... @@ -102,7 +136,7 @@ $(function(){
102 136 var map_ = WorldsBMapLine.init();
103 137  
104 138 /** 初始化绘图工具类 @param:<map_:map对象;styleOptions:绘图样式对象> @return:DrawingManager对象 */
105   -// DrawingManagerObj.init(map_,styleOptions);
  139 + DrawingManagerObj.init(map_,styleOptions);
106 140  
107 141 layer.msg('请生成路线!!!');
108 142  
... ... @@ -123,12 +157,12 @@ $(function(){
123 157 }
124 158  
125 159 // 上传GPS坐标生成路线事件
126   - $('#uploadRoute').on('click', function() {
  160 + $('#generationRoute').on('click', function() {
127 161 EditRoute.setLineId(id);
128   - EditRoute.setLineDir(direction);
  162 +// EditRoute.setLineDir(direction);
129 163 $.get('editRoute.html', function(m){
130 164 $(pjaxContainer).append(m);
131   - $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,GetAjaxData,PublicFunctions]);
  165 + $('#edit_route_mobal').trigger('editRouteMobal.show',[TransGPS,EditRoute,WorldsBMapLine,DrawingManagerObj,MapGetAjaxData,PublicFunctions]);
132 166 });
133 167 // 更新section_table 和缓存中的切点
134 168 WorldsBMapLine.initCutSectionPoint();
... ... @@ -144,10 +178,29 @@ $(function(){
144 178 var section = EditSectionObj.getEitdSection();
145 179 var josnSectionList = JSON.stringify(sectionList);
146 180 section.cutSectionList = josnSectionList;
147   - $.get('submit_select.html', function(m){
148   - $(pjaxContainer).append(m);
149   - $('#submit_select_mobal').trigger('submitSelectMobal.show',[section,EditRoute]);
  181 + // 版本号
  182 + $.get('/lineVersions/findCurrentVersion',{'lineId':id},function(versions){
  183 + section.versions = versions;
  184 + layer.confirm('提交马上会把原有的站点和路段覆盖,您确定要提交吗?', {
  185 + btn: ['提交','取消'] //按钮
  186 + }, function(index){
  187 + layer.close(index);
  188 + $.post('/section/sectionCut', section, function(resuntDate){
  189 + if(resuntDate.status=='SUCCESS') {
  190 + // 弹出添加成功提示消息
  191 + layer.msg('提交成功,跳转到线路详情页面!');
  192 + window.location.href = "/pages/base/stationroute/list.html?no="+section.sectionrouteLine+","+section.sectionrouteDirections;
  193 + }else {
  194 + // 弹出添加失败提示消息
  195 + layer.msg('提交失败...');
  196 + }
  197 + });
  198 + });
150 199 });
  200 +// $.get('submit_select.html', function(m){
  201 +// $(pjaxContainer).append(m);
  202 +// $('#submit_select_mobal').trigger('submitSelectMobal.show',[section,EditRoute]);
  203 +// });
151 204 } else {
152 205 layer.msg("请先截取路段!!!");
153 206 }
... ... @@ -179,7 +232,47 @@ $(function(){
179 232 } else {
180 233 layer.msg("没有截取路段,不可以撤销!!!");
181 234 }
182   - });
  235 + });
  236 +
  237 + // 监听右侧悬浮框导航栏事件
  238 + $('#section').on('click',function(){
  239 + $('#station').parent().removeClass('active');
  240 + $('#section').parent().addClass('active');
  241 + $('#station_list_div').removeClass('active');
  242 + $('#station_list_div').addClass('hidden');
  243 + $('#section_list_div').removeClass('hidden');
  244 + $('#section_list_div').addClass('active');
  245 + var generationType = EditRoute.getLineGenerationType();
  246 + // 更具生成类型展示不同页面
  247 + if(generationType == 'cite'){
  248 + $('#gpsSection').addClass('hidden');
  249 +
  250 + } else if(generationType == 'uploadGPS') {
  251 + $('#citeSection').addClass('hidden');
  252 + }
  253 + // 清除地图覆盖物
  254 + WorldsBMapLine.clearMarkAndOverlays();
  255 + var params = {};
  256 + var line = EditRoute.getLineObj();
  257 + params.lineId=line.id;
  258 + params.dir = line.dir;
  259 + // 查询路段信息
  260 + $get('/sectionroute/findCacheSection',params,function(data) {
  261 + var section_radio_html = '<div id="section_radio">';
  262 + var cont = 1;
  263 + var check = 'checked="checked"';
  264 + $.each(data,function(){
  265 + sectionRouteMap[this.sectionrouteId] = this;
  266 + section_radio_html += '<div class="radio"><label class="radio_label section"><input name="sectionRadio" type="radio" class="radioclass" value="'+this.sectionrouteId+'" '+(cont==1?check:"")+' />'+this.sectionName+"</label></div>";
  267 + cont++;
  268 + });
  269 + section_radio_html += '</div>';
  270 + $("#section_list_div #citeSection .defeat-scroll").html(section_radio_html);
  271 + // 在地图上画出线路走向
  272 + PublicFunctions.linePanlThree(line.id,data,line.dir);
  273 + });
  274 + });
  275 +
183 276 // 监听右侧悬浮框导航栏事件
184 277 $('#station').on('click',function(){
185 278 $('#section').parent().removeClass('active');
... ... @@ -201,7 +294,7 @@ $(function(){
201 294 var check = 'checked="checked"';
202 295 $.each(data,function(){
203 296 stationRouteMap[this.stationRouteId] = this;
204   - station_radio_html += '<div class="radio"><label class="radio_label on"><input name="stationRadio" type="radio" class="radioclass" value="'+this.stationRouteId+'" '+(cont==1?check:"")+' />'+this.stationRouteStationName+"</label></div>";
  297 + station_radio_html += '<div class="radio"><label class="radio_label station"><input name="stationRadio" type="radio" class="radioclass" value="'+this.stationRouteId+'" '+(cont==1?check:"")+' />'+this.stationRouteStationName+"</label></div>";
205 298 cont++;
206 299 });
207 300 station_radio_html += '</div>';
... ... @@ -209,33 +302,61 @@ $(function(){
209 302 });
210 303 });
211 304  
  305 + // 查询路段
  306 + $('#findSection').on('click', function(){
  307 + var id = $(".section input[type='radio']:checked").val();
  308 + var sectionRoute = sectionRouteMap[id];
  309 + if(id && sectionRoute){
  310 + WorldsBMapLine.drawingSection(sectionRoute);
  311 + } else if(id && !sectionRoute){
  312 + layer.msg('您选择的路段不存在,请重新选择!');
  313 + }else{
  314 + layer.msg('请先选择要查看的路段!');
  315 + }
  316 + });
  317 +
  318 + // 添加站点
  319 + $('#addStation').on('click', function(){
  320 + $.get('addstation_select.html', function(m){
  321 + $(pjaxContainer).append(m);
  322 + $('#addstation_select_mobal').trigger('AddSelectMobal.show', [WorldsBMapLine, DrawingManagerObj, MapGetAjaxData, EditRoute, PublicFunctions]);
  323 + });
  324 + });
  325 +
  326 + // 查询站点
212 327 $('#findStation').on('click', function(){
213   - var id = $("input[type='radio']:checked").val();
  328 + var id = $(".station input[type='radio']:checked").val();
214 329 var stationRoute = stationRouteMap[id];
215   - // 站点形状
216   - var shapesType = stationRoute.stationShapesType;
217   - // 如果是圆
218   - if(shapesType =='r') {
219   -
220   - // 百度地图画圆
221   - WorldsBMapLine.pointsCircle(stationRoute);
222   -
223   - // 如果是多变行
224   - }else if(shapesType == 'd') {
225   -
226   - // 百度地图画多边形
227   - WorldsBMapLine.pointsPolygon(stationRoute);
228   - }
  330 + if(id && stationRoute){
  331 + // 站点形状
  332 + var shapesType = stationRoute.stationShapesType;
  333 + // 如果是圆
  334 + if(shapesType =='r') {
  335 +
  336 + // 百度地图画圆
  337 + WorldsBMapLine.pointsCircle(stationRoute);
229 338  
  339 + // 如果是多变行
  340 + }else if(shapesType == 'd') {
  341 +
  342 + // 百度地图画多边形
  343 + WorldsBMapLine.pointsPolygon(stationRoute);
  344 + }
  345 + } else if(id && !stationRoute){
  346 + layer.msg('您选择的站点不存在,请重新选择!');
  347 + }else{
  348 + layer.msg('请先选择要查看的站点!');
  349 + }
230 350 });
  351 +
  352 + // 修改站点
231 353 $('#updateStation').on('click', function(){
232   - var id = $("input[type='radio']:checked").val();
  354 + var id = $(".station input[type='radio']:checked").val();
233 355 var stationRoute = stationRouteMap[id];
234   -
235 356 if(id && stationRoute){
236 357 $.get('editstation_select.html', function(m){
237 358 $(pjaxContainer).append(m);
238   - $('#editstation_select_mobal').trigger('editStationSelectMobal_show', [WorldsBMapLine, DrawingManagerObj, stationRoute]);
  359 + $('#editstation_select_mobal').trigger('editStationSelectMobal_show', [WorldsBMapLine, PublicFunctions, DrawingManagerObj, stationRoute]);
239 360 });
240 361 } else if(id && !stationRoute){
241 362 layer.msg('您选择的站点不存在,请重新选择!');
... ... @@ -243,25 +364,16 @@ $(function(){
243 364 layer.msg('请先选择要编辑的站点!');
244 365 }
245 366 });
246   - $('#section').on('click',function(){
247   - $('#station').parent().removeClass('active');
248   - $('#section').parent().addClass('active');
249   - $('#section_list_div').removeClass('hidden');
250   - $('#section_list_div').addClass('active');
251   - $('#station_list_div').removeClass('active');
252   - $('#station_list_div').addClass('hidden');
253   - // 清除地图覆盖物
254   - WorldsBMapLine.clearMarkAndOverlays();
255   -
256   - var line = EditRoute.getLineObj();
257   - lineid=line.id;
258   - directions = line.dir;
259   - // 查询路段信息
260   - $get('/sectionroute/findSectionCache',{'line.id_eq' : lineid , 'directions_eq' : directions},function(data) {
261   - // 在地图上画出线路走向
262   - PublicFunctions.linePanlThree(lineid,data,directions);
263   - });
  367 +
  368 + // 监听打开鼠标绘制工具按钮事件.
  369 + $('#oppenDrawingManager').on('click',function() {
  370 + DrawingManagerObj.drawingManagerOpen();
  371 + });
  372 + // 监听关闭鼠标绘制工具按钮事件.
  373 + $('#closeDrawingManager').on('click',function() {
  374 + DrawingManagerObj.drawingManagerClose();
264 375 });
  376 +
265 377 // 滚动轴监听事件
266 378 $('#scrllmouseEvent_div').on('mousemove',function() {
267 379 $('.defeat-scroll').css('overflow','auto');
... ... @@ -277,10 +389,12 @@ $(function(){
277 389 <!-- 地图类 -->
278 390 <script src="/pages/base/line/js/map.js"></script>
279 391 <!-- 函数与方法 -->
280   -<script src="/pages/base/line/js/line-map-function.js"></script>
  392 +<script src="/pages/base/line/js/map-function.js"></script>
281 393 <!-- 修改路段对象类 -->
282 394 <script src="/pages/base/stationroute/js/editsection.js"></script>
283 395 <!-- 绘图类 -->
284 396 <script src="/pages/base/line/js/drawingManager.js"></script>
285 397 <!-- ajax请求类 -->
286   -<script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script>
287 398 \ No newline at end of file
  399 +<!-- <script src="/pages/base/stationroute/js/stationroute-ajax-getdata.js"></script> -->
  400 +<!-- ajax请求类 -->
  401 +<script src="/pages/base/line/js/map-ajax-getdata.js"></script>
288 402 \ No newline at end of file
... ...
src/main/resources/static/pages/base/linecast/cast.html
... ... @@ -166,6 +166,33 @@ function getTreeData(cb){
166 166 });
167 167 }
168 168  
  169 +/**
  170 + * 将模块List 转换为树结构
  171 + * @param arr
  172 + * @returns {Array}
  173 + */
  174 +function createTreeData(arr){
  175 + var treeData = [];
  176 + var len = arr.length;
  177 + for(var i = 0; i < len; i ++){
  178 + var pId = arr[i].pId;
  179 + arr[i].text = arr[i].name;
  180 + if(!pId){
  181 + treeData.push(arr[i]);
  182 + }
  183 +
  184 + for(var j = 0; j < len; j ++){
  185 + if(pId == arr[j].id){
  186 + if(!arr[j].children)
  187 + arr[j].children = [];
  188 + arr[j].children.push(arr[i]);
  189 + break;
  190 + }
  191 + }
  192 + }
  193 + return treeData;
  194 +}
  195 +
169 196 function getModuleTreeData(userId){
170 197  
171 198  
... ...
src/main/resources/static/pages/base/lineversions/add.html
... ... @@ -44,6 +44,7 @@
44 44 <div class="form-body">
45 45 <input type="hidden" name="lineId" id="lineIdInput" />
46 46 <input type="hidden" name="lineCode" id="lineCodeInput" />
  47 + <input type="hidden" name="lineCode" id="statusInput" />
47 48  
48 49 <!-- 表单分组组件 form-group START -->
49 50 <div class="form-group">
... ... @@ -100,7 +101,7 @@
100 101 </div>
101 102 <!-- 表单分组组件 form-group END -->
102 103  
103   - <div class="form-group">
  104 + <!-- <div class="form-group">
104 105 <label class="control-label col-md-5">
105 106 <span class="required"> * </span>线路版本状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
106 107 </label>
... ... @@ -112,7 +113,7 @@
112 113 <option value="0">历史版本</option>
113 114 </select>
114 115 </div>
115   - </div>
  116 + </div> -->
116 117  
117 118 <!-- 表单分组组件 form-group START -->
118 119 <div class="form-group">
... ...
src/main/resources/static/pages/base/lineversions/edit.html
... ... @@ -44,6 +44,7 @@
44 44 <div class="form-body">
45 45 <input type="hidden" name="lineId" id="lineIdInput" />
46 46 <input type="hidden" name="lineCode" id="lineCodeInput" />
  47 + <input type="hidden" name="lineCode" id="statusInput" />
47 48  
48 49 <!-- 表单分组组件 form-group START -->
49 50 <div class="form-group">
... ... @@ -100,7 +101,7 @@
100 101 </div>
101 102 <!-- 表单分组组件 form-group END -->
102 103  
103   - <div class="form-group">
  104 + <!-- <div class="form-group">
104 105 <label class="control-label col-md-5">
105 106 <span class="required"> * </span>线路版本状态&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;:
106 107 </label>
... ... @@ -112,7 +113,7 @@
112 113 <option value="0">历史版本</option>
113 114 </select>
114 115 </div>
115   - </div>
  116 + </div> -->
116 117  
117 118 <!-- 表单分组组件 form-group START -->
118 119 <div class="form-group">
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-add-from.js
... ... @@ -37,13 +37,14 @@
37 37 });
38 38 }
39 39  
40   - // 填充公司下拉框选择值
  40 + // 填充线路下拉框选择值
41 41 function lineAllInfo(){
42 42 getComp(function(params) {
43 43 $get('/line/all', params, function(array){
44 44 // get请求获取公司
45 45 $get('/business/all', {upCode_eq: '88'}, function(compD){
46 46 var len_ = array.length,paramsD = new Array();
  47 + paramsD.push({'id':'请选择...','text':'请选择...'});
47 48 if(len_>0) {
48 49 $.each(array, function(i, g){
49 50 if(g.name!='' || g.name != null) {
... ... @@ -54,7 +55,7 @@
54 55 if($('span').hasClass('select2-selection'))
55 56 $('span .select2-selection').remove();
56 57 initPinYinSelect2($('#lineSelect'),paramsD,function(selector) {
57   - selector.select2("val", splitxlName(window.localStorage.xlName_AgursData));
  58 + selector.select2("val", "请选择...");
58 59 });
59 60 }
60 61 });
... ... @@ -65,16 +66,30 @@
65 66 // 监听线路名称下拉框值改变事件.
66 67 $('#lineSelect').on("change", function (e) {
67 68 var lineSelectValue = $('#lineSelect').val();// 获取线路名称值.
68   - if(lineSelectValue=='' || lineSelectValue==null) {
  69 + if(lineSelectValue=='' || lineSelectValue==null || lineSelectValue=="请选择...") {
69 70 $('#lineCodeInput').val('');// 设值线路编码.
70 71 $('#lineIdInput').val('');// 设值线路ID.
71 72 }else {
72 73 var lineSelectValueArray = lineSelectValue.split('_');// 切割线路名称值.
73   - $.get('/lineVersions/findLineVersionsMax',{'lineId':lineSelectValueArray[1]}, function(lineVersionsMax){
74   - $('#versionsInput').val(++lineVersionsMax.versions);// 设值线路编码.
75   - });
76   - $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
77   - $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  74 + $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[1]}, function(array){
  75 + var type = true;
  76 + $.each(array, function(){
  77 + if(this.status == 2) {
  78 + type = false;
  79 + return;
  80 + }
  81 + });
  82 + if(type) {
  83 + $.get('/lineVersions/findLineVersionsMax',{'lineId':lineSelectValueArray[1]}, function(lineVersionsMax){
  84 + $('#versionsInput').val(++lineVersionsMax.versions);// 设值线路编码.
  85 + });
  86 + $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
  87 + $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
  88 + } else {
  89 + swal("每条线路只能有一个待更新版本,你选择的线路已有待更新版本,版本多了忙不过来,快去选择其他线路吧!");
  90 + $('#lineSelect').select2("val", "请选择...");
  91 + }
  92 + });
78 93 }
79 94 });
80 95  
... ... @@ -118,7 +133,7 @@
118 133 'startDate' : {required : true},// 启用时间 不为空.
119 134 'endDate' : {required : true},// 结束时间.
120 135 'versions' : {required : true, digits : true, maxlength: 10},// 版本号 必填项、数字、最大长度10.
121   - 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
  136 +// 'status' : {required : true, digits : true, maxlength: 10},// 版本状态 必填项、数字、最大长度10.
122 137 },
123 138  
124 139 /**
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-edit-from.js
... ... @@ -37,7 +37,7 @@
37 37 });
38 38 }
39 39  
40   - // 填充公司下拉框选择值
  40 + // 填充线路下拉框选择值
41 41 function lineAllInfo(){
42 42 getComp(function(params) {
43 43 $get('/line/all', params, function(array){
... ...
src/main/resources/static/pages/base/lineversions/js/lineversions-list-table.js
... ... @@ -4,7 +4,7 @@
4 4 * @Description : TOOD(线路信息list.html页面js)
5 5 */
6 6  
7   -(function(){
  7 +
8 8 // 关闭左侧栏
9 9 if (!$('body').hasClass('page-sidebar-closed')) {$('.menu-toggler.sidebar-toggler').click();}
10 10 // 定义 page : 当前页;initPag ; icheckOptions:选择框
... ... @@ -269,6 +269,7 @@
269 269 return rsStr;
270 270 }
271 271  
  272 +
272 273 /** 搜索按钮事件 */
273 274 $('tr.filter .filter-submit').on('click',function(){
274 275 var params = getParams();
... ... @@ -280,5 +281,54 @@
280 281 /** 表格数据分页加载 @param:<params:搜索参数;true:是否重新分页> */
281 282 loadTableDate(params,true);
282 283 });
283   -
284   -})();
285 284 \ No newline at end of file
  285 +
  286 +
  287 +function updateVersionsRoute(obj){
  288 + var lineId = obj.dataset.lineid;
  289 + swal({
  290 + title: "操作须知",
  291 + text: "每周会更新数据,请在本周内做完线路走向并发布,不然您做的走向有可能会被覆盖!",
  292 + type: "warning",
  293 + showCancelButton: true,
  294 + confirmButtonColor: "#DD6B55",
  295 + confirmButtonText: "知道了!",
  296 + cancelButtonText: "不懂!",
  297 + closeOnConfirm: false },
  298 + function(isConfirm){
  299 + if(isConfirm){
  300 + var win1 = window.open("http://114.80.178.12:29088/login2.html","线路信息编辑","false");
  301 + setTimeout(function(){
  302 + window.open("http://114.80.178.12:29088/pages/base/stationroute/list.html?no="+lineId,"线路信息编辑","false");
  303 + },1500);
  304 + swal.close();
  305 + }
  306 + });
  307 +}
  308 +
  309 +function issueBnt(id){
  310 + swal({
  311 + title: "发布说明",
  312 + text: "重复发布会覆盖已有的数据,请确认线路信息正确后发布,发布后需要几分钟后才能再次发布!",
  313 + type: "warning",
  314 + showCancelButton: true,
  315 + confirmButtonColor: "#DD6B55",
  316 + confirmButtonText: "确定发布!",
  317 + cancelButtonText: "取消发布!",
  318 + closeOnConfirm: false },
  319 + function(){
  320 + $.post('/lineVersions/issueVersion',{'id':id},function(result){
  321 + if(result.status=='SUCCESS') {
  322 + // 弹出添加成功提示消息
  323 + swal("发布!", "线路站点及走向已发布至历史库,待到版本启用时间自动更新。", "success");
  324 + } else if(result.status=='ERROR') {
  325 + // 弹出添加失败提示消息
  326 + swal("发布失败!", "您发布的信息可能有误,请检查!", "ERROR");
  327 + }
  328 +// loadPage('list.html');
  329 + // 发布后刷新页面
  330 + var pData = getParams();
  331 + pData['line.name_like'] = splitxlName(pData['line.name_like']);
  332 + loadTableDate(pData, false);
  333 + });
  334 + });
  335 +}
286 336 \ No newline at end of file
... ...
src/main/resources/static/pages/base/lineversions/list.html
... ... @@ -26,7 +26,7 @@
26 26 </div>
27 27 <div class="actions">
28 28 <div class="btn-group btn-group-devided" data-toggle="buttons">
29   - <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路版本</a>
  29 + <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加待更新版本</a>
30 30 </div>
31 31 </div>
32 32 </div>
... ... @@ -37,9 +37,9 @@
37 37 <tr role="row" class="heading">
38 38 <th width="4%">序号</th>
39 39 <th width="5%">线路编码</th>
40   - <th width="8%">线路名称</th>
41   - <th width="8%">所属公司</th>
42   - <th width="9%">所属分公司</th>
  40 + <th width="6%">线路名称</th>
  41 + <th width="6%">所属公司</th>
  42 + <th width="6%">所属分公司</th>
43 43 <th width="8%">启用时间</th>
44 44 <th width="8%">终止时间</th>
45 45 <th width="6%">版本号</th>
... ... @@ -181,6 +181,8 @@
181 181 南汇维修公司
182 182 {{else if obj.line.brancheCompany == '5'}}
183 183 南汇公司
  184 + {{else if obj.brancheCompany == '6'}}
  185 + 航头枢纽站
184 186 {{/if}}
185 187  
186 188 {{/if}}
... ... @@ -208,6 +210,14 @@
208 210 </td>
209 211 <td>
210 212 <a href="edit.html?no={{obj.id}}" class="btn default blue-stripe btn-sm" data-pjax> 修改 </a>
  213 + {{if obj.status == '2'}}
  214 + <a class="btn default blue-stripe btn-sm" data-lineid="{{obj.line.id}}" onclick="updateVersionsRoute(this)" data-pjax> 编辑版本路线 </a>
  215 + {{/if}}
  216 + {{if obj.status == '2' && obj.isupdate!=1}}
  217 + <a class="btn btn-danger btn-sm" onclick = "issueBnt({{obj.id}})" data-pjax>发布</a>
  218 + {{else if obj.status == '2' && obj.isupdate==1}}
  219 + <a class="btn btn-danger btn-sm disabled">数据同步中</a>
  220 + {{/if}}
211 221 </td>
212 222 </tr>
213 223 {{/each}}
... ...
src/main/resources/static/pages/base/section/js/add-form-events.js
... ... @@ -22,12 +22,8 @@ $(function(){
22 22 $('#lineIdInput').val(lineSelectValueArray[0]);// 设值线路编码.
23 23 $('#lineCodeInput').val(lineSelectValueArray[1]);// 设值线路ID.
24 24 // 版本号赋值
25   - $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
26   - $.each(lineVersions,function(){
27   - if (this.status == 1) {
28   - $('#versionsInput').val(this.versions);
29   - }
30   - })
  25 + $.get('/lineVersions/findCurrentVersion',{'lineId':lineSelectValueArray[0]},function(versions){
  26 + $('#versionsInput').val(versions);
31 27 });
32 28 // 获取该线路下的路段路由.
33 29 PublicFunctions.getSectionRouteInfo(lineSelectValueArray[0],function(array) {
... ...
src/main/resources/static/pages/base/station/edit.html
... ... @@ -52,7 +52,7 @@
52 52 <span class="required"> * </span> 站点路由名称:
53 53 </label>
54 54 <div class="col-md-6">
55   - <input type="text" class="form-control" name="stationName" id="stationNameInput" placeholder="站点路由名称">
  55 + <input type="text" class="form-control" name="stationRouteName" id="stationRouteNameInput" placeholder="站点路由名称">
56 56 </div>
57 57 </div>
58 58 </div>
... ... @@ -246,7 +246,7 @@ $(&#39;#editPoitsions_station_mobal&#39;).on(&#39;editStationMobal_show&#39;, function(e, map,fu
246 246 errorClass : 'help-block help-block-error',
247 247 focusInvalid : false,
248 248 rules : {
249   - 'stationName' : {required : true},// 站点路由名称 必填项
  249 + 'stationRouteName' : {required : true},// 站点路由名称 必填项
250 250 'stationCod': {required : true,},// 站点编码 必填项
251 251 'directions' : {required : true,dirIs : true},// 站点方向 必填项 必填项
252 252 'stationRouteCode' : {isStart : true},// 站点序号
... ...
src/main/resources/static/pages/base/station/js/add-form-events.js
... ... @@ -24,12 +24,8 @@ $(function(){
24 24 $('#lineCodeInput').val(lineSelectValueArray[1]);
25 25 var params = {'lineCode_eq':lineSelectValueArray[1],'destroy_eq':0,'directions_eq':dir};
26 26 // 版本号赋值
27   - $.get('/lineVersions/findByLineId',{'lineId':lineSelectValueArray[0]},function(lineVersions){
28   - $.each(lineVersions,function(){
29   - if (this.status == 1) {
30   - $('#versionsInput').val(this.versions);
31   - }
32   - })
  27 + $.get('/lineVersions/findCurrentVersion',{'lineId':lineSelectValueArray[0]},function(versions){
  28 + $('#versionsInput').val(versions);
33 29 });
34 30 initSelect(params);
35 31 }
... ...
src/main/resources/static/pages/base/station/js/add-vmap-world.js
... ... @@ -140,7 +140,7 @@ var StationPVmapWorlds = function() {
140 140 });
141 141 },
142 142 // 打开绘画工具
143   - drawingManagerOpen : function(map) {
  143 + drawingManagerOpen : function() {
144 144 // 打开鼠标绘画工具
145 145 drawingManager.open();
146 146 // 设置属性
... ...
src/main/resources/static/pages/base/station/js/station-positions-function.js
... ... @@ -26,7 +26,7 @@ var PositionsPublicFunctions = function () {
26 26 // 中心坐标点
27 27 var point = new BMap.Point(BJwpoints[0], BJwpoints[1]);
28 28 var htm = '<HR style="border:1 dashed #987cb9" width="100%" color=#987cb9 SIZE=1>'+
29   - '<span style="color:#DDD;font-size: 15px;">站点名称:' + r[0].stationName + '</span>' +
  29 + '<span style="color:#DDD;font-size: 15px;">站点名称:' + r[0].zdmc + '</span>' +
30 30 '<span class="help-block" style="color:#DDD;font-size: 15px;">站点编码:' + r[0].stationCode + '</span>' +
31 31 '<span class="help-block" style="color:#DDD;font-size: 15px;">站点序号:' + r[0].stationRouteCode + '</span>' +
32 32 '<span class="help-block" style="color:#DDD;font-size: 15px;">站点类型:' + markTypeStr + '</span>' +
... ... @@ -47,7 +47,7 @@ var PositionsPublicFunctions = function () {
47 47 // 信息窗位置偏移值。
48 48 offset: new BMap.Size(500,80),
49 49 //标题
50   - title : '<h4 style="color:#FFFFFF">'+r[0].stationName+'站详情</h4>',
  50 + title : '<h4 style="color:#FFFFFF">'+r[0].zdmc+'站详情</h4>',
51 51 //设置不允许信窗发送短息
52 52 enableMessage : false,
53 53 //是否开启点击地图关闭信息窗口
... ... @@ -123,7 +123,7 @@ var PositionsPublicFunctions = function () {
123 123 // 获取站点名称元素设值
124 124 $('#zdmcInput').val(stationObj.zdmc);
125 125 // 获取站点名称元素设值
126   - $('#stationNameInput').val(stationObj.stationName);
  126 + $('#stationRouteNameInput').val(stationObj.stationRouteName);
127 127 // 获取站点编码元素设值
128 128 $('#stationCodInput').val(stationObj.stationCode);
129 129 // 获取站点类型元素设值
... ... @@ -183,7 +183,7 @@ var PositionsPublicFunctions = function () {
183 183 // 站点名称
184 184 $('#zdmcInput').val(stationObj.zdmc);
185 185 // 站点路由线路名称
186   - $('#stationNameInput').val(stationObj.stationName);
  186 + $('#stationRouteNameInput').val(stationObj.stationRouteName);
187 187 // 获取站点类型元素设值
188 188 $('#stationMarkSelect').val(stationObj.stationRouteStationMark);
189 189 // 获取站点方向元素设值
... ...
src/main/resources/static/pages/base/station/js/station-positions-map.js
... ... @@ -136,11 +136,11 @@ var StationPositionsWorldsBMap = function () {
136 136 $('#editPoitsions_station_mobal').trigger('editStationMobal_show', [StationPositionsWorldsBMap,PositionsPublicFunctions,PositionsStationObj]);
137 137 });
138 138 });
139   - // 编辑多
  139 + // 编辑多
140 140 }else if(stationShapesTypeV =='d') {
141 141 // 开启编辑功能(自 1.1 新增)
142 142 polygon.enableEditing();
143   - // 添加多行编辑事件
  143 + // 添加多行编辑事件
144 144 polygon.addEventListener('dblclick',function(e) {
145 145 // 获取编辑的多边形对象
146 146 var edit_pointE = polygon;
... ...
src/main/resources/static/pages/base/station/list_edit.html
... ... @@ -278,7 +278,5 @@
278 278 <!-- 表单组件 END -->
279 279 </div>
280 280 <!-- 信息容器组件 END -->
281   -
282   -<script src="/pages/base/station/js/positionstation.js"></script>
283 281 <script src="/pages/base/station/js/station-positions-function.js"></script>
284 282 <script src="/pages/base/station/js/station-list-edit.js"></script>
285 283 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -237,12 +237,8 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,stao
237 237 // 是否撤销
238 238 $('#destroySelect').val(0);
239 239 // 版本号
240   - $.get('/lineVersions/findByLineId',{'lineId':Line.id},function(lineVersions){
241   - $.each(lineVersions,function(){
242   - if (this.status == 1) {
243   - $('#versionsInput').val(this.versions);
244   - }
245   - })
  240 + $.get('/lineVersions/findCurrentVersion',{'lineId':Line.id},function(versions){
  241 + $('#versionsInput').val(versions);
246 242 });
247 243  
248 244 var initzdlyP = {'line.id_eq':Line.id,'destroy_eq':0,'directions_eq':Station.dir};
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -197,7 +197,6 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
197 197 layer.closeAll();
198 198 var editStationParmasObj = station_.getEitdStation();
199 199 var addLine = Line_.getLineObj();
200   - debugger
201 200 fun.setFormValue(editStationParmasObj);
202 201 var initzdlyP = {'lineCode_eq':editStationParmasObj.stationRouteLineCode,'destroy_eq':0,'directions_eq':editStationParmasObj.stationRouteDirections};
203 202 initSelect(initzdlyP);
... ... @@ -336,8 +335,12 @@ $(&#39;#edit_station_mobal&#39;).on(&#39;editSelectMobal_show&#39;, function(e, map_,ajaxd,stati
336 335 function setZdlyValue() {
337 336 ajaxd.findUpStationRouteCode(editStationParmasObj.stationRouteLine,editStationParmasObj.stationRouteDirections,editStationParmasObj.stationRouteStationRouteCode,function(str) {
338 337 if(str.length>0){
339   - /* var upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections; */
340   - var upStationRouteCode = str[0].stationRouteCode + '_' + editStationParmasObj.stationRouteStationMark + '_' + editStationParmasObj.stationRouteDirections;
  338 + var upStationRouteCode;
  339 + if (editStationParmasObj.stationRouteStationMark == 'E') {
  340 + upStationRouteCode = str[0].stationRouteCode + '_' + 'E' + '_' + editStationParmasObj.stationRouteDirections;
  341 + } else{
  342 + upStationRouteCode = str[0].stationRouteCode + '_' + str[0].stationRouteMarke + '_' + editStationParmasObj.stationRouteDirections;
  343 + }
341 344 $('#stationrouteSelect').select2('val',upStationRouteCode);
342 345 }else {
343 346 $('#stationrouteSelect').select2('val','请选择...');
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
... ... @@ -130,7 +130,7 @@ var GetAjaxData = function(){
130 130  
131 131 },
132 132  
133   - // 查询路段信息
  133 + // 查询站点信息
134 134 getStationRouteInfo : function(lineId,direction,callback) {
135 135 $get('/stationroute/all',{'line.id_eq' : lineId , 'directions_eq' : direction},function(resultdata) {
136 136 callback && callback(resultdata);
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
... ... @@ -83,10 +83,10 @@ $(function(){
83 83 $post('/stationroute/updSwitchDir?lineIds='+ Line.id,null,function(data) {
84 84 layer.close(index);
85 85 if(data.status=='SUCCESS') {
86   - // 弹出添加成功提示消息
  86 + // 弹出操作成功提示消息
87 87 layer.msg('操作成功...');
88 88 }else {
89   - // 弹出添加失败提示消息
  89 + // 弹出操作失败提示消息
90 90 layer.msg('操作成功...');
91 91 }
92 92 WorldsBMap.clearMarkAndOverlays();
... ... @@ -148,10 +148,10 @@ $(function(){
148 148 $post('/sectionroute/quoteSection',params,function(data) {
149 149 layer.close(index);
150 150 if(data.status=='SUCCESS') {
151   - // 弹出添加成功提示消息
  151 + // 弹出操作成功提示消息
152 152 layer.msg('操作成功...');
153 153 }else {
154   - // 弹出添加失败提示消息
  154 + // 弹出操作失败提示消息
155 155 layer.msg('操作成功...');
156 156 }
157 157 WorldsBMap.clearMarkAndOverlays();
... ... @@ -254,10 +254,10 @@ $(function(){
254 254 var params = {lineId:lineIdEvents.id};
255 255 GetAjaxData.createUsingSingle(params,function(data) {
256 256 if(data.status=='SUCCESS') {
257   - // 弹出添加成功提示消息
  257 + // 弹出生成成功提示消息
258 258 layer.msg('生成成功...');
259 259 }else {
260   - // 弹出添加失败提示消息
  260 + // 弹出生成失败提示消息
261 261 layer.msg('生成失败...');
262 262 }
263 263 });
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
... ... @@ -244,32 +244,41 @@ var PublicFunctions = function () {
244 244 params.shapesType = 'r';
245 245 // destroy:是否撤销
246 246 params.destroy = '0';
247   - // versions:版本号
248   - params.versions = '1';
  247 +
249 248 // 路段信息JSON字符串
250 249 params.sectionJSON = sectionJSON;
251 250 // 限速
252 251 params.speedLimit = '60';
253 252 params.baseRes = 'No';
254   - // 保存
255   - GetAjaxData.collectionSave(params,function(rd) {
256   - if(rd.status='SUCCESS') {
257   - // 关闭弹出层
258   - layer.closeAll();
259   - layer.msg('保存成功!');
260   - }else {
261   - // 保存失败
262   - layer.msg('保存失败!');
263   - }
264   - // 刷新树
265   - PublicFunctions.resjtreeDate(addLine.id,directionData);
266   - /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
267   - GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) {
268   - /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
269   - PublicFunctions.linePanlThree(addLine.id,data,directionData);
270   - });
  253 + // 获取版本号后提交添加
  254 + $.get('/lineVersions/findByLineId',{'lineId':addLine.id},function(lineVersions){
  255 + $.each(lineVersions,function(){
  256 + if (this.status == 1) {
  257 + // versions:版本号
  258 + params.versions = this.versions;
  259 + // 保存
  260 + GetAjaxData.collectionSave(params,function(rd) {
  261 + if(rd.status='SUCCESS') {
  262 + // 关闭弹出层
  263 + layer.closeAll();
  264 + layer.msg('保存成功!');
  265 + }else {
  266 + // 保存失败
  267 + layer.msg('保存失败!');
  268 + }
  269 + // 刷新树
  270 + PublicFunctions.resjtreeDate(addLine.id,directionData);
  271 + /** 查询上行路段信息 @param:<Line.id:线路Id;0:上行> @return:data:路段数据 */
  272 + GetAjaxData.getSectionRouteInfo(addLine.id,directionData,function(data) {
  273 + /** 在地图上画出线路走向 @param:<Line.id:线路Id;0:上行;data:路段数据> */
  274 + PublicFunctions.linePanlThree(addLine.id,data,directionData);
  275 + });
  276 + });
  277 + }
  278 + })
271 279 });
272 280  
  281 +
273 282 });
274 283 }
275 284 });
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-map.js
... ... @@ -216,7 +216,6 @@ var WorldsBMap = function () {
216 216  
217 217 // 地图画多边形
218 218 pointsPolygon : function(objStation) {
219   - debugger
220 219  
221 220 // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
222 221 mapBValue.setZoom(15);
... ... @@ -374,7 +373,6 @@ var WorldsBMap = function () {
374 373  
375 374 // 画圆
376 375 pointsCircle : function(objStation) {
377   - debugger
378 376  
379 377 // 将视图切换到指定的缩放等级,中心点坐标不变。注意:当有信息窗口在地图上打开时,地图缩放将保证信息窗口所在的坐标位置不动。(自1.2新增)
380 378 mapBValue.setZoom(16);
... ...
src/main/resources/static/pages/base/stationroute/list.html
... ... @@ -13,7 +13,7 @@
13 13 </div>
14 14 </div>
15 15 <!-- 左边栏 -->
16   - <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 380px;">
  16 + <div class="portlet-body" id="scrllmouseEvent" style="border: 1px solid rgb(255, 255, 255); display: block;min-height: 420px;">
17 17 <div class="row">
18 18 <!-- 上下行栏 -->
19 19 <div class="col-md-3 col-sm-3 col-xs-3">
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/ParameterObj.js
... ... @@ -895,7 +895,7 @@ var ParameterObj = function() {
895 895 },
896 896  
897 897 /**
898   - * 获取固定的停站时间(固定停站时间都是选的最大值
  898 + * 获取固定的停站时间(固定停站时间都是选的最大值,非平均停站
899 899 * @param oTimeObj 时间对象
900 900 * @param bIsUp 是否上行
901 901 * @param iXXTime 行驶时间
... ... @@ -1082,6 +1082,85 @@ var ParameterObj = function() {
1082 1082 },
1083 1083  
1084 1084 /**
  1085 + * 获取固定的停站时间(固定停站时间都是选的最小值,非平均停站)
  1086 + * @param oTimeObj 时间对象
  1087 + * @param bIsUp 是否上行
  1088 + * @returns int 停站时间
  1089 + */
  1090 + fnCalcuFixedMinStopNumber: function(oTimeObj, bIsUp) {
  1091 + _validInternal(); // 验证
  1092 + var oParam = this;
  1093 +
  1094 + // 双向停站
  1095 + if (oParam.isTwoWayStop()) {
  1096 + if (bIsUp) { // 上行
  1097 + if (this.isMPeakBc(oTimeObj)) { // 早高峰
  1098 + return 3;
  1099 + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1100 + return 3;
  1101 + } else { // 低谷
  1102 + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1103 + return 10;
  1104 + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1105 + return 10;
  1106 + } else { // 早高峰,晚高峰之间
  1107 + return 10;
  1108 + }
  1109 + }
  1110 +
  1111 + } else { // 下行
  1112 + if (this.isMPeakBc(oTimeObj)) { // 早高峰
  1113 + return 3;
  1114 + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1115 + return 3;
  1116 + } else { // 低谷
  1117 + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1118 + return 10;
  1119 + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1120 + return 10;
  1121 + } else { // 早高峰,晚高峰之间
  1122 + return 10;
  1123 + }
  1124 + }
  1125 + }
  1126 + } else { // 主站停站
  1127 + if (bIsUp == oParam.isUpOneWayStop()) {
  1128 + if (bIsUp) { // 上行
  1129 + if (this.isMPeakBc(oTimeObj)) { // 早高峰
  1130 + return 2;
  1131 + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1132 + return 2;
  1133 + } else { // 低谷
  1134 + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1135 + return 10;
  1136 + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1137 + return 10;
  1138 + } else { // 早高峰,晚高峰之间
  1139 + return 10;
  1140 + }
  1141 + }
  1142 + } else { // 下行
  1143 + if (this.isMPeakBc(oTimeObj)) { // 早高峰
  1144 + return 2;
  1145 + } else if (this.isEPeakBc(oTimeObj)) { // 晚高峰
  1146 + return 2;
  1147 + } else { // 低谷
  1148 + if (this.isTroughBeforMPeakStartBc(oTimeObj)) { // 早高峰开始前
  1149 + return 10;
  1150 + } else if (this.isTroughAfterEPeakEndBc(oTimeObj)) { // 晚高峰结束后
  1151 + return 10;
  1152 + } else { // 早高峰,晚高峰之间
  1153 + return 10;
  1154 + }
  1155 + }
  1156 + }
  1157 + } else { // 副站停战,2到3分钟
  1158 + return 2;
  1159 + }
  1160 + }
  1161 + },
  1162 +
  1163 + /**
1085 1164 * 获取行驶时间。
1086 1165 * @param timeObj 班次时间字符串
1087 1166 * @param isUp 是否上行
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalBcObj.js
... ... @@ -32,6 +32,7 @@ var InternalBcObj = function(
32 32 this._$_bcsj = otherParamObj.bcsj; // 班次历时
33 33 this._$_arrtime = otherParamObj.arrtime; // 到达时间对象
34 34 this._$_stoptime = otherParamObj.stoptime; // 停站时间
  35 + this._$_iEatTime = 0; // 吃饭时间
35 36 this._$_tccid = otherParamObj.tccid; // 停车场id
36 37 this._$_ttinfoid = otherParamObj.ttinfoid; // 时刻表id
37 38 this._$_xlid = otherParamObj.xl; // 线路id
... ... @@ -41,10 +42,35 @@ var InternalBcObj = function(
41 42 // 标记参数,这个班次用于计算,最后必须删除
42 43 this._$_bDelFlag = false;
43 44  
  45 + // 是否首末站
  46 + this._$_bIsFirstBc = false;
  47 + this._$_bIsLastBc = false;
  48 +
44 49 };
45 50  
46 51 //------------------- get/set 方法 -------------------//
47 52  
  53 +InternalBcObj.prototype.fnSetIsFirstBc = function(bFlag) {
  54 + this._$_bIsFirstBc = true;
  55 +};
  56 +InternalBcObj.prototype.fnIsFirstBc = function() {
  57 + return this._$_bIsFirstBc;
  58 +};
  59 +
  60 +InternalBcObj.prototype.fnSetIsLastBc = function(bFlag) {
  61 + this._$_bIsLastBc = bFlag;
  62 +};
  63 +InternalBcObj.prototype.fnIsLastBc = function() {
  64 + return this._$_bIsLastBc;
  65 +};
  66 +
  67 +InternalBcObj.prototype.fnSetEatTime = function(iTime) {
  68 + this._$_iEatTime = iTime;
  69 +};
  70 +InternalBcObj.prototype.fnGetEatTime = function() {
  71 + return this._$_iEatTime;
  72 +};
  73 +
48 74 InternalBcObj.prototype.fnSetDelFlag = function(bFlag) {
49 75 this._$_bDelFlag = bFlag;
50 76 };
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalLpObj.js
... ... @@ -455,7 +455,7 @@ InternalLpObj.prototype.removeBc = function(qIndex, bcIndex) {
455 455 * @param hasDown boolean 计算下行班次
456 456 * @returns [{第几圈},{第几个班次}]
457 457 */
458   -InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
  458 +InternalLpObj.prototype.fnGetQBcIndexWithFcTimeFromGroupArray = function(
459 459 fctime, groupArray, hasUp, hasDown
460 460 ) {
461 461 var i;
... ... @@ -468,11 +468,15 @@ InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
468 468 var bc2time;
469 469  
470 470 var tempdiff;
  471 +
  472 + console.log("比较时间=" + fctime.format("HH:mm"));
  473 +
471 474 for (i = 0; i < this._$_qCount; i++) {
472 475 group = groupArray[i];
473 476 if (group) {
474 477 if (group.getBc1() && hasUp) {
475 478 bc1time = group.getBc1().getFcTimeObj();
  479 + console.log("bc1time=" + bc1time.format("HH:mm") + " tempdiff=" + tempdiff);
476 480 tempdiff = Math.abs(bc1time.diff(fctime));
477 481  
478 482 if (!timediff) {
... ... @@ -485,7 +489,7 @@ InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
485 489 qIndex = i;
486 490 bcIndex = 0;
487 491 } if (Math.abs(tempdiff) == timediff) {
488   - if (bc1time.isBefore(fctime)) {
  492 + if (bc1time.isAfter(fctime)) {
489 493 timediff = tempdiff;
490 494 qIndex = i;
491 495 bcIndex = 0;
... ... @@ -497,6 +501,7 @@ InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
497 501  
498 502 if (group.getBc2() && hasDown) {
499 503 bc2time = group.getBc2().getFcTimeObj();
  504 + console.log("bc2time=" + bc2time.format("HH:mm") + " tempdiff=" + tempdiff);
500 505 tempdiff = Math.abs(bc2time.diff(fctime));
501 506  
502 507 if (!timediff) {
... ... @@ -521,6 +526,8 @@ InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
521 526 }
522 527 }
523 528  
  529 + console.log("中标线对应数组索引=" + qIndex);
  530 +
524 531 var rst = [];
525 532 rst.push(qIndex);
526 533 rst.push(bcIndex);
... ... @@ -540,7 +547,7 @@ InternalLpObj.prototype.getgetQBcIndexWithFcTimeFromGroupArray = function(
540 547 InternalLpObj.prototype.getQBcIndexWithFcTime = function(
541 548 fctime, hasUp, hasDown
542 549 ) {
543   - return this.getgetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray, hasUp, hasDown);
  550 + return this.fnGetQBcIndexWithFcTimeFromGroupArray(fctime, this._$_groupBcArray, hasUp, hasDown);
544 551 };
545 552  
546 553 //---------------------- 内部数据初始化方法(不同于构造函数)---------------------//
... ... @@ -584,10 +591,10 @@ InternalLpObj.prototype.initDataFromTimeToTime = function(
584 591 //console.log("last;" + bcData[bcCount -1].getFcTimeObj().format("HH:mm"));
585 592 //console.log("endtime: " + endTime.format("HH:mm"));
586 593  
587   - if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {
588   - // 如果最后一个班次的到达时间超过结束时间,也要去除
589   - bcData.splice(bcCount - 1, 1);
590   - }
  594 + //if (bcCount > 0 && bcData[bcCount - 1].getArrTimeObj().isAfter(endTime)) {
  595 + // // 如果最后一个班次的到达时间超过结束时间,也要去除
  596 + // bcData.splice(bcCount - 1, 1);
  597 + //}
591 598  
592 599 this._initDataFromLbBcArray(bcData, fromQ);
593 600  
... ... @@ -738,7 +745,7 @@ InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, para
738 745 "cf",
739 746 !oPreBc.isUp(), // 和上一个班次方向相反
740 747 1,
741   - oPreBc.getArrTimeObj(), // 使用上一个班次的到达时间作为开始时间
  748 + paramObj.addMinute(oPreBc.getArrTimeObj(), oPreBc.getStopTime()), // 使用上一个班次的到达时间作为开始时间
742 749 paramObj
743 750 );
744 751  
... ... @@ -749,8 +756,10 @@ InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, para
749 756 iBcModifyTime = oEatBc.getArrTimeObj().diff(this.getBc(groupIndex, bcIndex).getFcTimeObj(), "m");
750 757 this.fnAddMinuteToBcFcsj(groupIndex, bcIndex, iBcModifyTime);
751 758  
752   - oPreBc.setStopTime(0);
753   - this._$_other_bc_array.push(oEatBc);
  759 + oPreBc.setStopTime(0); // 不重置停站时间
  760 + oPreBc.fnSetEatTime(oEatBc.getBcTime());
  761 +
  762 + //this._$_other_bc_array.push(oEatBc);
754 763  
755 764 return iBcModifyTime;
756 765 } else {
... ... @@ -759,6 +768,73 @@ InternalLpObj.prototype.fnAddEatBc = function(groupIndex, bcIndex, factory, para
759 768  
760 769 };
761 770  
  771 +/**
  772 + * 调整路牌的班次,通过调整停站时间,或者班次发车时间,不能让班次的到达时间和下一个班次的发车时间重叠。
  773 + * @param iPeakAverStopTime 高峰平均停站时间
  774 + * @param iTroughAverStopTime 低谷平均停站时间
  775 + * @param oParam 参数对象
  776 + */
  777 +InternalLpObj.prototype.fnAdjustBcInterval = function(iPeakAverStopTime, iTroughAverStopTime, oParam) {
  778 + // 获取车次链个数
  779 + var iBcChainCount = this.fnGetBcChainCount();
  780 +
  781 + var i;
  782 + var j;
  783 + var oBcIndex;
  784 + var iQIndex;
  785 + var iBcIndex;
  786 + var iBcCount;
  787 + var oBc;
  788 + var oNextBc;
  789 +
  790 + var iBcStopTime;
  791 +
  792 + for (i = 0; i < iBcChainCount; i++) {
  793 + oBcIndex = this.fnGetBcChainInfo(i);
  794 + iQIndex = oBcIndex["s_q"];
  795 + iBcIndex = oBcIndex["s_b"];
  796 + iBcCount = oBcIndex["bcount"];
  797 +
  798 + for (j = 0; j < iBcCount - 1; j++) {
  799 + oBc = this.getBc(iQIndex, iBcIndex);
  800 + oNextBc = this.getBc(
  801 + iBcIndex == 0 ? iQIndex : iQIndex + 1,
  802 + iBcIndex == 0 ? 1 : 0);
  803 +
  804 + if (oNextBc.fnIsFirstBc()) { // 如果同一路牌连续2个方向首站班次,都不做处理
  805 + continue;
  806 + }
  807 +
  808 + // 不改变当前班次的行驶时间,修正停站时间和下一个班次的发车时间
  809 + iBcStopTime = oNextBc.getFcTimeObj().diff(oBc.getArrTimeObj(), "m");
  810 + if (iBcStopTime < 0) {
  811 + // 当前班次使用最小停站时间
  812 + oBc.setStopTime(oParam.fnCalcuFixedMinStopNumber(oBc.getArrTimeObj(), oBc.isUp()));
  813 + oNextBc.addMinuteToFcsj(oBc.getStopTime() + oBc.fnGetEatTime() - iBcStopTime);
  814 +
  815 + } else {
  816 + if (iBcStopTime == oBc.getStopTime() + oBc.fnGetEatTime()) {
  817 + // 停站时间一致,没有问题
  818 +
  819 +
  820 + } else {
  821 + // TODO:当前班次使用最小停站时间
  822 + oBc.setStopTime(oParam.fnCalcuFixedMinStopNumber(oBc.getArrTimeObj(), oBc.isUp()));
  823 + oNextBc.addMinuteToFcsj(oBc.getStopTime() + oBc.fnGetEatTime() - iBcStopTime);
  824 +
  825 + }
  826 + }
  827 +
  828 + iBcIndex = iBcIndex == 0 ? 1 : 0;
  829 + iQIndex = iBcIndex == 0 ? iQIndex + 1 : iQIndex;
  830 + }
  831 +
  832 + this.getBc(iQIndex, iBcIndex).setStopTime(0);
  833 + }
  834 +
  835 +
  836 +};
  837 +
762 838  
763 839 // TODO
764 840  
... ... @@ -771,3 +847,8 @@ InternalLpObj.prototype.calcuLpBx = function() {
771 847 };
772 848  
773 849  
  850 +
  851 +
  852 +
  853 +
  854 +
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/core/InternalScheduleObj.js
... ... @@ -73,12 +73,12 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
73 73 isUp = !isUp;
74 74 } while(_kssj.isBefore(et));
75 75 bcCount--; // 因为先做do,所以总的班次要减1
76   - if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) {
77   - // 如果最后一个班次的到达时间超过结束时间,也要去除
78   - bcFcsjArrays.splice(bcCount - 1, 1);
79   - bcArsjArrays.splice(bcCount - 1, 1);
80   - bcCount--;
81   - }
  76 + //if (bcCount > 0 && bcArsjArrays[bcCount - 1].isAfter(et)) {
  77 + // // 如果最后一个班次的到达时间超过结束时间,也要去除
  78 + // bcFcsjArrays.splice(bcCount - 1, 1);
  79 + // bcArsjArrays.splice(bcCount - 1, 1);
  80 + // bcCount--;
  81 + //}
82 82 var _qCount_p1 = Math.floor(bcCount / 2); // 2个班次一圈
83 83 var _qCount_p2 = bcCount % 2; // 余下的1个班次也算一圈
84 84  
... ... @@ -116,26 +116,47 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
116 116  
117 117 // 以上标线为基础,计算各种班型工时对应的圈数、班次数
118 118 var aBcArray = _internalLpArray[0].getBcArray();
  119 + aBcArray[0].fnSetIsFirstBc(true); // 设置首班班次标识
  120 +
119 121 if (aBcArray.length % 2 != 0) { // 不能整除2,去除一个班次计算
120 122 aBcArray.splice(aBcArray.length - 1, 1);
121 123 }
122   - var sum = 0;
123   - // 加吃饭时间
124   - sum += _paramObj.fnGetLunchTime();
125   - sum += _paramObj.fnGetDinnerTime();
126   - // 加进出场时间
127   - sum += _qIsUp ? _paramObj.getUpOutTime() : _paramObj.getDownOutTime();
128   - sum += _qIsUp ? _paramObj.getDownInTime() : _paramObj.getUpInTime();
  124 +
  125 + // 午饭吃饭时间
  126 + var iLTime = _paramObj.fnGetLunchTime();
  127 + // 晚饭吃饭时间
  128 + var iDTime = _paramObj.fnGetDinnerTime();
  129 + // 出场时间
  130 + var iOutTime = _qIsUp ? _paramObj.getUpOutTime() : _paramObj.getDownOutTime();
  131 + // 进场时间
  132 + var iInTime = _qIsUp ? _paramObj.getDownInTime() : _paramObj.getUpInTime();
129 133 // 例保时间
130   - //sum += _paramObj.getLbTime() * 2;
  134 + var iBTime = _paramObj.getLbTime();
  135 +
  136 + var sum = 0; // 总班次时间
131 137 for (i = 0; i < aBcArray.length; i++) {
132 138 sum += aBcArray[i].getBcTime() + aBcArray[i].getStopTime();
133 139 }
  140 + sum += iLTime; // 加午饭时间
  141 + sum += iDTime; // 加晚饭时间
134 142 for (i = 0; i < _aBxDesc.length; i++) {
135   - _aBxDesc[i].fAverTime = sum / (aBcArray.length / 2);
136   - _aBxDesc[i].fBcCount = ((_aBxDesc[i].fHoursV * 60) / _aBxDesc[i].fAverTime) * 2;
  143 + _aBxDesc[i].fAverTime = sum / (aBcArray.length / 2); // 平均周转时间不算进出场,例保时间
  144 +
  145 + // 计算5休2的班次数(双进出场,4个例保)
  146 + if (i == 6) {
  147 + _aBxDesc[i].fQCount =
  148 + (_aBxDesc[i].fHoursV * 60 - iOutTime * 2 - iInTime * 2 - iBTime * 4) /
  149 + _aBxDesc[i].fAverTime;
  150 + _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2;
  151 + } else { // 进出场,2个例保
  152 + _aBxDesc[i].fQCount =
  153 + (_aBxDesc[i].fHoursV * 60 - iOutTime - iInTime - iBTime * 2) /
  154 + _aBxDesc[i].fAverTime;
  155 + _aBxDesc[i].fBcCount = _aBxDesc[i].fQCount * 2;
  156 + }
137 157 }
138 158  
  159 +
139 160 // 在第一个班次之前再添加一个模拟班次,用于中标线的作用
140 161 // 那一圈必定是低谷,而且圈索引0,班次索引1,暂时标记,最后删除
141 162 var iFirstStopTime =
... ... @@ -342,9 +363,14 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
342 363 throw "总分班路牌数小于加班路牌数";
343 364 }
344 365  
  366 + //// 修正连班路牌数,班次间隔大于20的,加1,直至班次间隔小于20
  367 + //while(_paramObj.calcuPeakZzsj() / iDgminpc > 20) {
  368 + // iDgminpc ++;
  369 + //}
345 370 _iBx_lb_lpcount = iDgminpc;
  371 +
346 372 _iBx_5_2_fb_lpcount = i_5_2_lpes;
347   - _iBx_other_fb_lpcount = iCls - iDgminpc - i_5_2_lpes;
  373 + _iBx_other_fb_lpcount = iCls - _iBx_lb_lpcount - i_5_2_lpes;
348 374  
349 375 //------------------------ 2、利用间隔法计算连班路牌分布 --------------------//
350 376 var i;
... ... @@ -384,7 +410,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
384 410 _internalLpArray[iLpIndex].setBxDesc("5休2分班");
385 411 }
386 412 for (i = 0; i < iC2; i++) {
387   - iLpIndex = aNotLbIndexes[_iBx_lb_lpcount - iC2 + i * (iC1 + 1)];
  413 + iLpIndex = aNotLbIndexes[_iBx_5_2_fb_lpcount - iC2 + i * (iC1 + 1)];
388 414 _internalLpArray[iLpIndex].setBxLb(false);
389 415 _internalLpArray[iLpIndex].setBxFb(true);
390 416 _internalLpArray[iLpIndex].setBxFb5_2(true);
... ... @@ -401,7 +427,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
401 427 }
402 428 }
403 429  
404   -
  430 + console.log("高峰周转时间:" + _paramObj.calcuPeakZzsj());
405 431 console.log("连班路牌数:" + _iBx_lb_lpcount);
406 432 console.log("5休2分班路牌数:" + _iBx_5_2_fb_lpcount);
407 433 console.log("其他分班路牌数:" + _iBx_other_fb_lpcount);
... ... @@ -434,7 +460,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
434 460 var _iZbx_lpIndex; // 中标线对应第几个路牌
435 461  
436 462 var _fnInitFun4 = function() { // 初始化方法4
437   - console.log("//---------------- 行车计划,初始化方法3 start ----------------//");
  463 + console.log("//---------------- 行车计划,初始化方法4 start ----------------//");
438 464  
439 465 //---------------------------- 1、模拟一个中标线,使用临时路牌 ----------------------//
440 466 // 构造中标线
... ... @@ -463,6 +489,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
463 489 //------------------------ 2、找出中标线的早高峰班次,计算应该插在当前路牌数组的那个位置 ----------------//
464 490 // 找出中标线对应的早高峰的班次对象
465 491 var oZb_gf_bc = oTempLp.getBc(_approximate_zgfQIndex, _approximate_zgfBIndex);
  492 + //alert(oZb_gf_bc.getFcTimeObj().format("HH:mm"));
466 493  
467 494 // 把所有连班路牌高峰班次重新构造成一个一个的圈数组,计算对应中标线最近的是第几个路牌
468 495 // 中标线和上标线一样在连班路牌上
... ... @@ -492,7 +519,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
492 519  
493 520 }
494 521  
495   - var aTtindex = oTempLp.getgetQBcIndexWithFcTimeFromGroupArray(
  522 + var aTtindex = oTempLp.fnGetQBcIndexWithFcTimeFromGroupArray( // 找出最接近中标线的路牌索引
496 523 oZb_gf_bc.getFcTimeObj(),
497 524 aTempq,
498 525 true,
... ... @@ -500,25 +527,36 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
500 527 );
501 528  
502 529 _iZbx_lpIndex = aLbIndexes[aTtindex[0]]; // 中标线放在第几个路牌
503   - oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象
504   - oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔
505   - oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb());
506   - oTempLp.setBxFb(_internalLpArray[_iZbx_lpIndex].isBxFb());
507   - oTempLp.setBxFb5_2(_internalLpArray[_iZbx_lpIndex].isBxFb5_2());
508   -
509   - // 修正除了第一个班次外,其余其他班次
510   - var iBcindex = 0;
511   - for (i = 1; i < _qCount; i++) {
512   - while (iBcindex <= 1) {
513   - if (oTempLp.getBc(i, iBcindex)) { // 替换存在的班次
514   - oTempLp.setBc(i, iBcindex, _fnGenerateBc(_iZbx_lpIndex, i, iBcindex));
  530 +
  531 + oTempLp.getMinBcObj().fnSetIsFirstBc(true); // 设置首班班次标识
  532 +
  533 + if (_iZbx_lpIndex == 0) { // 如果中标线和上标线一致
  534 + var oFirstBcIndexes = oTempLp.getMinBcObjPosition();
  535 + var oFirstBc = oTempLp.getMinBcObj();
  536 + oFirstBc.setLp(_internalLpArray[_iZbx_lpIndex]);
  537 + oFirstBc.fnSetDelFlag(false);
  538 + _internalLpArray[_iZbx_lpIndex].setBc(oFirstBcIndexes[0], oFirstBcIndexes[1], oFirstBc);
  539 + } else {
  540 + oTempLp.setLp(_lpArray[_iZbx_lpIndex]); // 设置原始路牌对象
  541 + oTempLp._$_aVerticalIntervalTime = _internalLpArray[_iZbx_lpIndex]._$_aVerticalIntervalTime; // 设置纵向最小发车间隔
  542 + oTempLp.setBxLb(_internalLpArray[_iZbx_lpIndex].isBxLb());
  543 + oTempLp.setBxFb(_internalLpArray[_iZbx_lpIndex].isBxFb());
  544 + oTempLp.setBxFb5_2(_internalLpArray[_iZbx_lpIndex].isBxFb5_2());
  545 +
  546 + // 修正除了第一个班次外,其余其他班次
  547 + var iBcindex = 0;
  548 + for (i = 1; i < _qCount; i++) {
  549 + while (iBcindex <= 1) {
  550 + if (oTempLp.getBc(i, iBcindex)) { // 替换存在的班次
  551 + oTempLp.setBc(i, iBcindex, _fnGenerateBc(_iZbx_lpIndex, i, iBcindex));
  552 + }
  553 + iBcindex ++;
515 554 }
516   - iBcindex ++;
  555 + iBcindex = 0;
517 556 }
518   - iBcindex = 0;
519   - }
520 557  
521   - _internalLpArray[_iZbx_lpIndex] = oTempLp;
  558 + _internalLpArray[_iZbx_lpIndex] = oTempLp;
  559 + }
522 560  
523 561 console.log("中标线对应第" + (_iZbx_lpIndex + 1) + "个路牌");
524 562  
... ... @@ -579,72 +617,75 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
579 617 }
580 618 };
581 619  
582   -
583 620 /**
584   - * 在指定位置生成班次(内部重要方法)。
585   - * @param lpIndex 第几个路牌
586   - * @param qIndex 第几圈
587   - * @param bcIndex 第几个班次
588   - * @returns InternalBcObj
  621 + * 获取班次列表。
  622 + * @param oIsUp 是否上行
  623 + * @param oStartTime 开始时间对象
  624 + * @returns [(InternalBcObj)]
589 625 */
590   - var _generateBc = function(lpIndex, qIndex, bcIndex) {
591   - // 在初始化布局后使用,否则没有参照班次加不了
592   - // 初始化布局后,相当于把时刻表比作一个围棋棋盘,行为路牌数,列为圈数
593   - // 上标线,中标线,早晚高峰已经布局在棋盘上,其余的空格可以创建班次
594   -
595   - // 这个生成班次是以上一班次时间,以发车间隔为基础添加的,纵向加
596   - // 和生成标线时那种一直往后加班次时不一样,那种是以前一个班次为基础,横向加
597   -
598   - // 1、生成的班次以同一圈同一个方向里离它最早的班次的发车时间为基础
599   - // 2、以每个路牌的纵向最小发车间隔时间为计算发车间隔
600   - // 3、如果班次发车时间越界不管,有其余方法排除这种情况
  626 + var _fnGetBcList2 = function(oIsUp, oStartTime) {
  627 + var i;
  628 + var j;
  629 + var oLp;
  630 + var oBc;
  631 + var aBc = [];
601 632  
602   - // 1、查找同圈同方向里最近的班次,找不到报错(因为有标线存在是不可能找不到的)
603   - var _i;
604   - var _bcObj;
605   - for (_i = lpIndex - 1; _i >= 0; _i--) {
606   - _bcObj = _internalLpArray[_i].getBc(qIndex, bcIndex);
607   - if (_bcObj) {
608   - break;
  633 + for (j = 0; j < _qCount; j++) {
  634 + for (i = 0; i < _internalLpArray.length; i++) {
  635 + oLp = _internalLpArray[i];
  636 + oBc = oLp.getBc(
  637 + j,
  638 + _qIsUp == oIsUp ? 0 : 1
  639 + );
  640 + if (oBc && oBc.getFcTimeObj().isAfter(oStartTime)) {
  641 + aBc.push(oBc);
  642 + }
609 643 }
610 644 }
611   - if (!_bcObj) {
612   - return false;
613   - //alert("无法在指定位置生成班次");
614   - //throw "无法在路牌index=" + lpIndex + ",圈index=" + qIndex + ",班次index=" + bcIndex + "生成班次";
615   - }
616 645  
617   - // 2、计算发车间隔
618   - var _intervalTime = 0;
619   - for (_i = _i + 1; _i <= lpIndex; _i++) {
620   - _intervalTime += _internalLpArray[_i].getVerticalMinIntervalTime();
  646 + var aBcFcTime = [];
  647 + for (i = 0; i < aBc.length; i++) {
  648 + oBc = aBc[i];
  649 + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
621 650 }
  651 + console.log((oIsUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
622 652  
623   - // 3、计算班次并添加班次
624   - var _kssj = _paramObj.addMinute(_bcObj.getFcTimeObj(), _intervalTime);
625   - _bcObj = _factory.createBcObj(
626   - _internalLpArray[lpIndex],
627   - "normal", _bcObj.isUp(),
628   - 1, _kssj, _paramObj);
629   - _bcObj.setGroup(_internalLpArray[lpIndex].getGroup(qIndex));
630   -
631   - return _bcObj;
632   -
633   - // TODO:这种添加班次的方法,可能造成相邻班次的停站时间问题
634   - // TODO:主要是由于中标线的问题,但是误差不会很大,
635   - // TODO:后面有方法直接调整停站时间(所谓的平滑过度时间)
  653 + return aBc;
636 654 };
637 655  
638 656 /**
639   - * 在指定位置生成班次并添加到路牌指定位置中。
640   - * @param lpIndex 第几个路牌
641   - * @param qIndex 第几圈
642   - * @param bcIndex 第几个班次
  657 + * 获取班次列表。
  658 + * @param isUp boolean 是否上行
  659 + * @returns [(InternalBcObj)]
643 660 */
644   - var _generateBcAndSetBc = function(lpIndex, qIndex, bcIndex) {
645   - var _bcObj = _generateBc(lpIndex, qIndex, bcIndex);
646   - _internalLpArray[lpIndex].setBc(qIndex, bcIndex, _bcObj);
  661 + var _fnGetBcList = function(isUp) {
  662 + var i;
  663 + var j;
  664 + var oLp;
  665 + var oBc;
  666 + var aBc = [];
  667 +
  668 + for (j = 0; j < _qCount; j++) {
  669 + for (i = 0; i < _internalLpArray.length; i++) {
  670 + oLp = _internalLpArray[i];
  671 + oBc = oLp.getBc(
  672 + j,
  673 + _qIsUp == isUp ? 0 : 1
  674 + );
  675 + if (oBc) {
  676 + aBc.push(oBc);
  677 + }
  678 + }
  679 + }
  680 +
  681 + var aBcFcTime = [];
  682 + for (i = 0; i < aBc.length; i++) {
  683 + oBc = aBc[i];
  684 + aBcFcTime.push(oBc.getFcTimeObj().format("HH:mm"));
  685 + }
  686 + console.log((isUp ? "上行班次列表:" : "下行班次列表:") + aBcFcTime.join(","));
647 687  
  688 + return aBc;
648 689 };
649 690  
650 691 /**
... ... @@ -653,9 +694,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
653 694 * @param isUp 是否上行
654 695 * @returns [{路牌index},{圈index},{班次index}]
655 696 */
656   - var _findUpClosedBcIndexWithTime = function(timeObj, isUp) {
657   -
658   - // dododo
  697 + var _fnFindUpClosedBcIndexWithTime = function(timeObj, isUp) {
659 698  
660 699 var _lpObj;
661 700 var _groupObj;
... ... @@ -672,9 +711,9 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
672 711 for (_j = 0; _j < _internalLpArray.length; _j++) {
673 712 _lpObj = _internalLpArray[_j];
674 713 _groupObj = _lpObj.getGroup(_i);
675   - _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2();
  714 + _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2();
676 715 if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
677   - _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  716 + _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
678 717 }
679 718 if (_bcObj) {
680 719 if (timeObj.diff(_bcObj.getFcTimeObj()) >= 0) {
... ... @@ -714,7 +753,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
714 753 * @param isUp 是否上行
715 754 * @returns [{路牌index},{圈index},{班次index}]
716 755 */
717   - var _findDownClosedBcIndexWithTime = function(timeObj, isUp) {
  756 + var _fnFindDownClosedBcIndexWithTime = function(timeObj, isUp) {
718 757 var _lpObj;
719 758 var _groupObj;
720 759 var _bcObj;
... ... @@ -732,9 +771,10 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
732 771 for (_j = 0; _j < _internalLpArray.length; _j++) {
733 772 _lpObj = _internalLpArray[_j];
734 773 _groupObj = _lpObj.getGroup(_i);
735   - _bcObj = isUp ? _groupObj.getBc1() : _groupObj.getBc2();
  774 + // TODO:bug
  775 + _bcObj = isUp == _qIsUp ? _groupObj.getBc1() : _groupObj.getBc2();
736 776 if (!_bcObj) { // 没有班次动态生成一个,可能生成不出的
737   - _bcObj = _generateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
  777 + _bcObj = _fnGenerateBc(_j, _i, isUp == _qIsUp ? 0 : 1);
738 778 }
739 779 if (_bcObj) {
740 780 //console.log("timeobj -> bcobj diff flag " +
... ... @@ -777,6 +817,48 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
777 817 return bcindex;
778 818 };
779 819  
  820 + /**
  821 + * 获取班次索引。
  822 + * @param oBc 班次对象
  823 + * @returns [{路牌索引},{圈索引},{班次索引}]
  824 + */
  825 + var _fnGetBcIndex = function(oBc) {
  826 + // 路牌索引
  827 + var i;
  828 + var iLpIndex;
  829 + for (i = 0; i < _internalLpArray.length; i++) {
  830 + if (_internalLpArray[i]._$$_orign_lp_obj == oBc._$$_internal_lp_obj._$$_orign_lp_obj) {
  831 + iLpIndex = i;
  832 + break;
  833 + }
  834 + }
  835 + // 圈索引
  836 + var j;
  837 + var iGroupIndex;
  838 + var bFlag = false;
  839 + for (i = 0; i < _internalLpArray.length; i++) {
  840 + if (bFlag) {
  841 + break;
  842 + }
  843 + for (j = 0; j < _qCount; j++) {
  844 + if (_internalLpArray[i]._$_groupBcArray[j] == oBc._$$_internal_group_obj) {
  845 + iGroupIndex = j;
  846 + bFlag = true;
  847 + break;
  848 + }
  849 + }
  850 + }
  851 + // 班次索引
  852 + var iBcIndex = _qIsUp == oBc.isUp() ? 0 : 1;
  853 +
  854 + if (iLpIndex == undefined) {
  855 + return null;
  856 + } else {
  857 + return [].concat(iLpIndex, iGroupIndex, iBcIndex);
  858 + }
  859 +
  860 + };
  861 +
780 862 return {
781 863 //------------- 布局初始化方法 ------------//
782 864 /**
... ... @@ -805,14 +887,14 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
805 887 fnAdjustGfbc : function(isZgf, isUp) {
806 888 var oStartTime; // 开始时间
807 889 var oEndTime; // 结束时间
808   - var iStartBcIndex; // 开始班次索引
809   - var iEndBcIndex; // 结束班次索引
  890 + var aStartBcIndex; // 开始班次索引
  891 + var aEndBcIndex; // 结束班次索引
810 892  
811 893 oStartTime = isZgf ? _paramObj.getMPeakStartTimeObj() : _paramObj.getEPeakStartTimeObj();
812 894 oEndTime = isZgf ? _paramObj.getMPeakEndTimeObj() : _paramObj.getEPeakEndTimeObj();
813 895  
814   - aStartBcIndex = _findUpClosedBcIndexWithTime(oStartTime, isUp);
815   - aEndBcIndex = _findDownClosedBcIndexWithTime(oEndTime, isUp);
  896 + aStartBcIndex = _fnFindUpClosedBcIndexWithTime(oStartTime, isUp);
  897 + aEndBcIndex = _fnFindDownClosedBcIndexWithTime(oEndTime, isUp);
816 898  
817 899 var iLpIndex;
818 900 var iQIndex;
... ... @@ -848,6 +930,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
848 930 iQInternelCount = aEndBcIndex[1] - aStartBcIndex[1] - 1;
849 931 for (i = 1; i <= iQInternelCount; i++) {
850 932 oLp = _internalLpArray[iQIndex + i];
  933 +
851 934 if (!oLp.getBc(iQIndex + i, iBcIndex)) {
852 935 _fnGenerateBcAndSetBc(i, iQIndex + i, iBcIndex);
853 936 }
... ... @@ -1024,14 +1107,15 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1024 1107 * 从车次链的后面开始加
1025 1108 */
1026 1109 fnCalcuLpBx_other: function() {
1027   - // TODO:暂时使用做2休1的班型
1028   - // 计算做5休2班型所需的班次数
1029   - var iBxBcount = _aBxDesc[4].fBcCount;
1030   - if (iBxBcount - Math.floor(iBxBcount) > 0.7) {
1031   - iBxBcount = Math.floor(iBxBcount) + 1;
1032   - } else {
1033   - iBxBcount = Math.floor(iBxBcount);
  1110 + // TODO:根据上标线的首班时间确定班型,小于05:59的做一休一,否则做二休一
  1111 + var oSt = _qIsUp ? _paramObj.getUpFirstDTimeObj() : _paramObj.getDownFirstDTimeObj();
  1112 + var iBxIndex = 4;
  1113 + if (oSt.isBefore(_paramObj.toTimeObj("05:59"))) {
  1114 + iBxIndex = 5;
1034 1115 }
  1116 + // 计算做5休2班型所需的班次数
  1117 + var iQBcount = _aBxDesc[iBxIndex].fQCount;
  1118 + var iBxBcount = Math.round(iQBcount) * 2;
1035 1119  
1036 1120 var i;
1037 1121 var j;
... ... @@ -1110,8 +1194,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1110 1194 while (iTempBcIndex <= 1) {
1111 1195 oBc = _fnGenerateBc(aLbLpindexes[i], j, iTempBcIndex);
1112 1196 if (oBc &&
1113   - oBc.getFcTimeObj().isBefore(oEndsj) &&
1114   - oBc.getArrTimeObj().isBefore(oEndsj)) {
  1197 + oBc.getFcTimeObj().isBefore(oEndsj) ) {
1115 1198 oLp.setBc(j, iTempBcIndex, oBc);
1116 1199 }
1117 1200 iTempBcIndex++;
... ... @@ -1177,157 +1260,97 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1177 1260 },
1178 1261  
1179 1262 /**
1180   - * 计算末班车(一般都落在连班班型上,因为按照现在的布局方法,分班路牌不会一直连到最后)。
1181   - * 1、确定末班车早的班次
1182   - * 2、从后往前找到与这个班次最匹配的班次的位置(第几个路牌,第几圈,第几个班次),然后覆盖
1183   - * 3、从第2步找的位置,往上找与另一个末班车匹配的班次位置,然后覆盖
  1263 + * 计算末班车。
  1264 + * 1、将上下行拉成上下行两个班次列表(包括标记班次)
  1265 + * 2、分别找出离末班车发车时间最近的班次,并替换时间
  1266 + * 3、删除之后的班次
1184 1267 */
1185 1268 fnCalcuLastBc: function() {
1186   - //-------------------- 1、确定末班车早的方向,时间 -----------------------//
1187   - var _oLastTime;
1188   - var _bLastIsUp;
  1269 + var i;
  1270 + var iTimeDiff;
  1271 + var iTempTime;
  1272 + var aBc;
  1273 + var oLastBcTime;
  1274 + var oLastBcIsUp;
  1275 + var iModifyIndex;
  1276 +
  1277 + // 查找末班车早的末班车时间和方向
1189 1278 if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) {
1190   - _oLastTime = _paramObj.getUpLastDtimeObj();
1191   - _bLastIsUp = true;
  1279 + oLastBcTime = _paramObj.getUpLastDtimeObj();
  1280 + oLastBcIsUp = true;
1192 1281 } else {
1193   - _oLastTime = _paramObj.getDownLastDTimeObj();
1194   - _bLastIsUp = false;
  1282 + oLastBcTime = _paramObj.getDownLastDTimeObj();
  1283 + oLastBcIsUp = false;
1195 1284 }
1196 1285  
1197   - //-------------------- 2、确定比 _oLastTime 小或者等于的班次位置,并修改班次时间到末班车时间 -----------------//
1198   - var i;
1199   - var j;
1200   - var _oBc;
1201   - var _oLp;
1202   - var _aBcIndex;
1203   -
1204   - for (i = _qCount - 1; i >= 0; i--) {
1205   - if (_aBcIndex) {
1206   - break;
1207   - }
1208   - // 从大到小找到第一个合适的班次索引
1209   - for (j = _internalLpArray.length - 1; j >= 0; j--) {
1210   - _oLp = _internalLpArray[j];
1211   - if (_oLp.isBxLb()) {
1212   - _oBc = _oLp.getBc(i, _qIsUp == _bLastIsUp ? 0 : 1);
1213   - }
1214   - if (_oBc != undefined && _oBc.getFcTimeObj().isBefore(_oLastTime)) {
1215   - _aBcIndex = [];
1216   - _aBcIndex.push(j); // 路牌索引
1217   - _aBcIndex.push(i); // 圈索引
1218   - _aBcIndex.push(_qIsUp == _bLastIsUp ? 0 : 1); // 班次索引
1219   - break;
1220   - }
  1286 + // 确定早的末班车时间
  1287 + aBc = _fnGetBcList(oLastBcIsUp);
  1288 + for (i = 0; i < aBc.length; i++) {
  1289 + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
  1290 + if (iTimeDiff == undefined) {
  1291 + iTimeDiff = iTempTime;
  1292 + iModifyIndex = i;
  1293 + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
  1294 + iTimeDiff = iTempTime;
  1295 + iModifyIndex = i;
1221 1296 }
1222 1297 }
1223   -
1224   - //-------------------- 3、预估哪个个班次离末班最近,用末班替换,并删除后面的多余班次 -----------------//
1225   - // 第2步找到的班次不一定是最适合的,需要把之后的班次模拟出来再比较一下
1226   - var _aBcIndexes = []; // 里面放对象 {lpIndex,qIndex,bcIndex,fcsjTime}
1227   - _oBc = undefined;
1228   - for (i = _aBcIndex[0]; i < _internalLpArray.length; i++) {
1229   - _oLp = _internalLpArray[i];
1230   - if (_oLp.isBxLb()) {
1231   - _oBc = _oLp.getBc(_aBcIndex[1], _aBcIndex[2]);
1232   - if (_oBc == undefined) {
1233   - _oBc = _fnGenerateBc(i, _aBcIndex[1], _aBcIndex[2]);
1234   - }
1235   - _aBcIndexes.push({
1236   - lpIndex: i,
1237   - qIndex: _aBcIndex[1],
1238   - bcIndex: _aBcIndex[2],
1239   - bcObj: _oBc
1240   - })
1241   - }
1242   - }
1243   - var _oBcIndex_find; // 第几个路牌离末班车最近
1244   - for (i = _aBcIndexes.length - 1; i >= 0; i--) {
1245   - if (_aBcIndexes[i].bcObj.getFcTimeObj().isBefore(_oLastTime)) {
1246   - _oBcIndex_find = _aBcIndexes[i];
1247   - break;
1248   - }
1249   - }
1250   - // 替换成末班车
1251   - _oBc = _oBcIndex_find.bcObj;
1252   - _oBc.addMinuteToFcsj(_oLastTime.diff(_oBc.getFcTimeObj(), "m"));
1253   - _internalLpArray[_oBcIndex_find.lpIndex].setBc(
1254   - _oBcIndex_find.qIndex, _oBcIndex_find.bcIndex, _oBc
1255   - );
1256   -
1257   - // 删除多余班次呢
1258   - for (i = _oBcIndex_find.lpIndex + 1; i < _internalLpArray.length; i++) {
1259   - _internalLpArray[i].removeBc(_oBcIndex_find.qIndex, _oBcIndex_find.bcIndex);
  1298 + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
  1299 + aBc[iModifyIndex].fnSetDelFlag(false);
  1300 + aBc[iModifyIndex].fnSetIsLastBc(true);
  1301 + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
  1302 + _qIsUp == oLastBcIsUp ?
  1303 + aBc[i]._$$_internal_group_obj.setBc1(undefined) :
  1304 + aBc[i]._$$_internal_group_obj.setBc2(undefined);
1260 1305 }
1261 1306  
1262   - //---------------------- 4、从第3步找到的位置,开始往上找,确定另一个末班车,并删除后面多余的班次 -------------//
1263   - // 因为另一个末班车时间晚,肯定在后面,并且必须在之前的路牌
1264   - // 如果在之后的路牌,则意味着之前那个末班车位置不对,连班连起来会有两个之前的末班车
1265   - // 计算大的末班车时间
  1307 + // 查找末班车晚的末班车时间和方向
1266 1308 if (_paramObj.getUpLastDtimeObj().isBefore(_paramObj.getDownLastDTimeObj())) {
1267   - _oLastTime = _paramObj.getDownLastDTimeObj();
1268   - _bLastIsUp = false;
  1309 + oLastBcTime = _paramObj.getDownLastDTimeObj();
  1310 + oLastBcIsUp = false;
1269 1311 } else {
1270   - _oLastTime = _paramObj.getUpLastDtimeObj();
1271   - _bLastIsUp = true;
  1312 + oLastBcTime = _paramObj.getUpLastDtimeObj();
  1313 + oLastBcIsUp = true;
1272 1314 }
1273   - _aBcIndexes = [];
1274   - for (i = _oBcIndex_find.lpIndex; i >=0; i--) {
1275   - _oLp = _internalLpArray[i];
1276   - if (_oLp.isBxLb()) {
1277   - _oBc = _oLp.getBc(
1278   - _oBcIndex_find.bcIndex == 0 ? _oBcIndex_find.qIndex : _oBcIndex_find.qIndex + 1,
1279   - _oBcIndex_find.bcIndex == 0 ? 1 : 0
1280   - );
1281   - if (_oBc == undefined) {
1282   - _oBc = _fnGenerateBc(
1283   - i,
1284   - _oBcIndex_find.bcIndex == 0 ? _oBcIndex_find.qIndex : _oBcIndex_find.qIndex + 1,
1285   - _oBcIndex_find.bcIndex == 0 ? 1 : 0
1286   - );
1287   - }
1288   - if (!_oBc) { // 纵向生成班次失败,用横向生成班次,发车时间取前一班次的到达时间加停战时间
1289   - _oBc = _factory.createBcObj(
1290   - _oLp,
1291   - "normal",
1292   - _bLastIsUp,
1293   - 3,
1294   - _oLp.getBc(_oBcIndex_find.qIndex, _oBcIndex_find.bcIndex).getArrTimeObj(),
1295   - _paramObj
1296   - );
  1315 + // 确定晚的末班车时间
  1316 + aBc = _fnGetBcList(oLastBcIsUp);
  1317 + var oBc;
  1318 + var aBcIndex;
  1319 + var iLpIndex;
  1320 + var iQIndex;
  1321 + var iBcIndex;
1297 1322  
1298   - }
1299   - _aBcIndexes.push({
1300   - lpIndex: i,
1301   - qIndex: _oBcIndex_find.bcIndex == 0 ? _oBcIndex_find.qIndex : _oBcIndex_find.qIndex + 1,
1302   - bcIndex: _oBcIndex_find.bcIndex == 0 ? 1 : 0,
1303   - bcObj: _oBc
1304   - })
1305   - }
1306   - }
  1323 + iTimeDiff = undefined;
  1324 + for (i = 0; i < aBc.length; i++) {
  1325 + oBc = aBc[i];
  1326 + aBcIndex = _fnGetBcIndex(oBc);
1307 1327  
1308   - console.log(_aBcIndexes);
  1328 + iLpIndex = aBcIndex[0];
  1329 + iQIndex = aBcIndex[2] == 0 ? aBcIndex[1] -1 : aBcIndex[1];
  1330 + iBcIndex = aBcIndex[2] == 0 ? 1 : 0;
1309 1331  
1310   - _oBcIndex_find = _aBcIndexes[0];
  1332 + if (!_internalLpArray[iLpIndex].getBc(iQIndex, iBcIndex)) {
  1333 + continue;
  1334 + }
1311 1335  
1312   - for (i = 0; i < _aBcIndexes.length; i++) {
1313   - if (_aBcIndexes[i].bcObj.getFcTimeObj().isBefore(_oLastTime)) {
1314   - _oBcIndex_find = _aBcIndexes[i];
1315   - break;
  1336 + iTempTime = oLastBcTime.diff(aBc[i].getFcTimeObj(), "m");
  1337 + if (iTimeDiff == undefined) {
  1338 + iTimeDiff = iTempTime;
  1339 + iModifyIndex = i;
  1340 + } else if (Math.abs(iTempTime) <= Math.abs(iTimeDiff)) {
  1341 + iTimeDiff = iTempTime;
  1342 + iModifyIndex = i;
1316 1343 }
1317 1344 }
1318   - // 替换成末班车
1319   - _oBc = _oBcIndex_find.bcObj;
1320   - _oBc.addMinuteToFcsj(_oLastTime.diff(_oBc.getFcTimeObj(), "m"));
1321   - _internalLpArray[_oBcIndex_find.lpIndex].setBc(
1322   - _oBcIndex_find.qIndex, _oBcIndex_find.bcIndex, _oBc
1323   - );
1324   -
1325   - // 删除多余班次呢
1326   - for (i = _oBcIndex_find.lpIndex + 1; i < _internalLpArray.length; i++) {
1327   - _internalLpArray[i].removeBc(_oBcIndex_find.qIndex, _oBcIndex_find.bcIndex);
  1345 + aBc[iModifyIndex].addMinuteToFcsj(iTimeDiff); // 替换成末班车时间
  1346 + aBc[iModifyIndex].fnSetDelFlag(false);
  1347 + aBc[iModifyIndex].fnSetIsLastBc(true);
  1348 + for (i = iModifyIndex + 1; i < aBc.length; i++) { // 删除多余班次
  1349 + _qIsUp == oLastBcIsUp ?
  1350 + aBc[i]._$$_internal_group_obj.setBc1(undefined) :
  1351 + aBc[i]._$$_internal_group_obj.setBc2(undefined);
1328 1352 }
1329 1353  
1330   -
1331 1354 },
1332 1355  
1333 1356 /**
... ... @@ -1411,7 +1434,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1411 1434 /**
1412 1435 * 补每个路牌的其他班次(进出场,例保班次)。
1413 1436 */
1414   - fnCalcuOtherBc: function() {
  1437 + fnCalcuOtherBc_: function() {
1415 1438 var i;
1416 1439 var _lpObj;
1417 1440 var _minBcIndex;
... ... @@ -1419,6 +1442,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1419 1442 var _minBc;
1420 1443 var _maxBc;
1421 1444 var _otherbc = [];
  1445 + var _oFbbc;
1422 1446  
1423 1447 for (i = 0; i < _internalLpArray.length; i++) {
1424 1448 _lpObj = _internalLpArray[i];
... ... @@ -1428,11 +1452,11 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1428 1452 _maxBc = _lpObj.getBc(_maxBcIndex[0], _maxBcIndex[1]);
1429 1453  
1430 1454 _otherbc = [];
1431   - //_otherbc.push(_factory.createBcObj(
1432   - // _lpObj, "bd", true, 1,
1433   - // _minBc.getFcTimeObj(),
1434   - // _paramObj
1435   - //));
  1455 + _otherbc.push(_factory.createBcObj(
  1456 + _lpObj, "bd", true, 1,
  1457 + _minBc.getFcTimeObj(),
  1458 + _paramObj
  1459 + ));
1436 1460 _otherbc.push(_factory.createBcObj(
1437 1461 _lpObj, "out", true, 1,
1438 1462 _minBc.getFcTimeObj(),
... ... @@ -1446,11 +1470,30 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1446 1470 _maxBc.getArrTimeObj(),
1447 1471 _paramObj
1448 1472 ));
1449   - //_otherbc.push(_factory.createBcObj(
1450   - // _lpObj, "lc", true, 1,
1451   - // _maxBc.getArrTimeObj(),
1452   - // _paramObj
1453   - //));
  1473 + _otherbc.push(_factory.createBcObj(
  1474 + _lpObj, "lc", true, 1,
  1475 + _maxBc.getArrTimeObj(),
  1476 + _paramObj
  1477 + ));
  1478 +
  1479 + // 5休2分班出场例保班次
  1480 + if (_lpObj.isBxFb5_2()) {
  1481 + _oFbbc = _lpObj.getBc(
  1482 + _lpObj.fnGetBcChainInfo(1)["s_q"],
  1483 + _lpObj.fnGetBcChainInfo(1)["s_b"]
  1484 + );
  1485 +
  1486 + _otherbc.push(_factory.createBcObj(
  1487 + _lpObj, "bd", true, 1,
  1488 + _oFbbc.getFcTimeObj(),
  1489 + _paramObj
  1490 + ));
  1491 + _otherbc.push(_factory.createBcObj(
  1492 + _lpObj, "out", true, 1,
  1493 + _oFbbc.getFcTimeObj(),
  1494 + _paramObj
  1495 + ));
  1496 + }
1454 1497  
1455 1498 _lpObj.addOtherBcArray(_otherbc);
1456 1499 }
... ... @@ -1458,13 +1501,132 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1458 1501 },
1459 1502  
1460 1503 /**
1461   - * 祛除上标线有删除标记的班次。
  1504 + * 补每个路牌的其他班次(进出场,例保班次)
  1505 + * 所有的车次链前后都加进出场、报道班次
1462 1506 */
1463   - fnRemoveDelFlagBc: function() {
  1507 + fnCalcuOtherBc: function() {
  1508 + var i;
  1509 + var j;
  1510 + var iBcChainCount;
  1511 + var oLp;
  1512 + var aOtherBc;
  1513 + var oStartBc;
  1514 + var oEndBc;
  1515 +
  1516 + for (i = 0; i < _internalLpArray.length; i++) {
  1517 + aOtherBc = [];
  1518 + oLp = _internalLpArray[i];
  1519 + iBcChainCount = oLp.fnGetBcChainCount();
  1520 +
  1521 + if (iBcChainCount == 1) { // 只有一个车次链,是连班班型
  1522 + // 头部要添加出场,例保班次
  1523 + oStartBc = oLp.getBc(
  1524 + oLp.fnGetBcChainInfo(0)["s_q"],
  1525 + oLp.fnGetBcChainInfo(0)["s_b"]
  1526 + );
  1527 + aOtherBc.push(_factory.createBcObj(
  1528 + oLp, "bd", true, 1,
  1529 + oStartBc.getFcTimeObj(),
  1530 + _paramObj
  1531 + ));
  1532 + aOtherBc.push(_factory.createBcObj(
  1533 + oLp, "out", true, 1,
  1534 + oStartBc.getFcTimeObj(),
  1535 + _paramObj
  1536 + ));
  1537 +
  1538 + // 尾部需添加进场,例保班次
  1539 + oEndBc = oLp.getBc(
  1540 + oLp.fnGetBcChainInfo(0)["e_q"],
  1541 + oLp.fnGetBcChainInfo(0)["e_b"]
  1542 + );
  1543 + aOtherBc.push(_factory.createBcObj(
  1544 + oLp, "in", true, 1,
  1545 + oEndBc.getArrTimeObj(),
  1546 + _paramObj
  1547 + ));
  1548 + aOtherBc.push(_factory.createBcObj(
  1549 + oLp, "lc", true, 1,
  1550 + oEndBc.getArrTimeObj(),
  1551 + _paramObj
  1552 + ));
  1553 + } else if (iBcChainCount == 2) { // 两个车次链,是分班班型
  1554 + // 第一个车次链开头有出场,报到班次,车次链结尾只有进场班次
  1555 + oStartBc = oLp.getBc(
  1556 + oLp.fnGetBcChainInfo(0)["s_q"],
  1557 + oLp.fnGetBcChainInfo(0)["s_b"]
  1558 + );
  1559 + aOtherBc.push(_factory.createBcObj(
  1560 + oLp, "bd", true, 1,
  1561 + oStartBc.getFcTimeObj(),
  1562 + _paramObj
  1563 + ));
  1564 + aOtherBc.push(_factory.createBcObj(
  1565 + oLp, "out", true, 1,
  1566 + oStartBc.getFcTimeObj(),
  1567 + _paramObj
  1568 + ));
  1569 +
  1570 + oEndBc = oLp.getBc(
  1571 + oLp.fnGetBcChainInfo(0)["e_q"],
  1572 + oLp.fnGetBcChainInfo(0)["e_b"]
  1573 + );
  1574 + aOtherBc.push(_factory.createBcObj(
  1575 + oLp, "in", true, 1,
  1576 + oEndBc.getArrTimeObj(),
  1577 + _paramObj
  1578 + ));
  1579 +
  1580 + // 第二个车次链开头只有出场班次,车次链结尾有进场,报到班次
  1581 + oStartBc = oLp.getBc(
  1582 + oLp.fnGetBcChainInfo(1)["s_q"],
  1583 + oLp.fnGetBcChainInfo(1)["s_b"]
  1584 + );
  1585 + aOtherBc.push(_factory.createBcObj(
  1586 + oLp, "out", true, 1,
  1587 + oStartBc.getFcTimeObj(),
  1588 + _paramObj
  1589 + ));
  1590 +
  1591 + oEndBc = oLp.getBc(
  1592 + oLp.fnGetBcChainInfo(1)["e_q"],
  1593 + oLp.fnGetBcChainInfo(1)["e_b"]
  1594 + );
  1595 + aOtherBc.push(_factory.createBcObj(
  1596 + oLp, "in", true, 1,
  1597 + oEndBc.getArrTimeObj(),
  1598 + _paramObj
  1599 + ));
  1600 + aOtherBc.push(_factory.createBcObj(
  1601 + oLp, "lc", true, 1,
  1602 + oEndBc.getArrTimeObj(),
  1603 + _paramObj
  1604 + ));
  1605 +
  1606 +
  1607 + } else {
  1608 + // 2个车次链以上,暂时没有此班型
  1609 + }
  1610 +
  1611 + oLp.addOtherBcArray(aOtherBc);
  1612 + }
  1613 + },
  1614 +
  1615 + /**
  1616 + * 祛除上标线开头的删除标记的班次。
  1617 + */
  1618 + fnRemoveDelFirstFlagBc: function() {
1464 1619 var oLp = _internalLpArray[0];
1465 1620 var aMinBcIndex = oLp.getMinBcObjPosition();
1466   - oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]);
1467   -
  1621 + if (oLp.getBc(aMinBcIndex[0], aMinBcIndex[1]).fnIsDelFlag()) {
  1622 + oLp.removeBc(aMinBcIndex[0], aMinBcIndex[1]);
  1623 + }
  1624 + },
  1625 + /**
  1626 + * 祛除上标线结尾的删除标记的班次。
  1627 + */
  1628 + fnRemoveDelLastFlagBc: function() {
  1629 + var oLp = _internalLpArray[0];
1468 1630 var aMaxBcIndex = oLp.getMaxBcObjPosition();
1469 1631 if (oLp.getBc(aMaxBcIndex[0], aMaxBcIndex[1]).fnIsDelFlag()) {
1470 1632 oLp.removeBc(aMaxBcIndex[0], aMaxBcIndex[1]);
... ... @@ -1472,117 +1634,248 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1472 1634 },
1473 1635  
1474 1636 /**
1475   - * 调整班次纵向间隔(发车时间调整)。
1476   - * 1、只调整分班班次的发车时间
1477   - * 2、调整每两个连班之间的分班班次组
1478   - * 3、如果不是连续的班次才调整
  1637 + * 调整路牌班次间隔(核准周转时间,停站时间)。
  1638 + * @param iFre int 迭代次数
1479 1639 */
1480   - fnAdjust_vertical_bc_interval: function() {
1481   - var i;
1482   - var j;
1483   - var iBIndex = 0;
1484   - var oLbGroup = {};
1485   - var oLp;
1486   - for (i = 0; i < _qCount; i++) {
1487   - while (iBIndex <= 1) {
1488   - oLbGroup[i + "_" + iBIndex] = [];
1489   - for (j = 0; j < _internalLpArray.length; j++) {
1490   - oLp = _internalLpArray[j];
1491   - if (oLp.isBxLb()) {
1492   - if (oLp.getBc(i, iBIndex)) {
1493   - oLbGroup[i + "_" + iBIndex].push(j);
1494   - }
  1640 + fnAdjustLpBcInterval: function(iFre) {
  1641 + if (iFre > 0) {
  1642 + for (var i = 0; i < _internalLpArray.length; i++) {
  1643 + _internalLpArray[i].fnAdjustBcInterval(
  1644 + this.fnCalcuAverPeakStopTime(),
  1645 + this.fnCalcuAverTroughStopTime(),
  1646 + _paramObj);
  1647 + }
  1648 +
  1649 + this.fnAdjustLpBcInterval(iFre - 1);
  1650 + }
  1651 + },
  1652 +
  1653 + /**
  1654 + * 调整班次间隔。
  1655 + * @param bIsUp 是否上行
  1656 + * @param oStartTime 开始时间对象
  1657 + * @param iFre 迭代次数
  1658 + */
  1659 + fnAdjustBcInterval2_: function(bIsUp, oStartTime, iFre) {
  1660 + if (iFre > 0) {
  1661 + var aBc = _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表
  1662 + aBc.sort(function(o1, o2) {
  1663 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1664 + return -1;
  1665 + } else {
  1666 + return 1;
  1667 + }
  1668 + });
  1669 + var i;
  1670 + var j;
  1671 +
  1672 + var iBcCountOfGroup = 3; // 3个班次取一次计算
  1673 + var aBcOfGroup; // 3个班次列表
  1674 + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
  1675 +
  1676 + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
  1677 + aBcOfGroup = [];
  1678 + aBcIntervalOfGroup = [];
  1679 + for (j = i; j < i + iBcCountOfGroup; j++) {
  1680 + aBcOfGroup.push(aBc[j]);
  1681 + }
  1682 +
  1683 + for (j = 0; j < aBcOfGroup.length; j++) {
  1684 + if (j < aBcOfGroup.length - 1) {
  1685 + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
  1686 + aBcOfGroup[j].getFcTimeObj(), "m"));
1495 1687 }
1496 1688 }
1497   - if (oLbGroup[i + "_" + iBIndex].length == 1) {
1498   - oLbGroup[i + "_" + iBIndex] = [];
  1689 +
  1690 + if (aBcIntervalOfGroup[0] < 19) {
  1691 + aBcOfGroup[1].addMinuteToFcsj(1);
  1692 + } else if (aBcIntervalOfGroup[0] > 20) {
  1693 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1694 + } else {
  1695 + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  1696 + //continue;
  1697 + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  1698 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1699 + } else {
  1700 + aBcOfGroup[1].addMinuteToFcsj(1);
  1701 + }
1499 1702 }
1500 1703  
1501   - iBIndex ++;
1502 1704 }
1503   - iBIndex = 0;
  1705 +
  1706 + this.fnAdjustBcInterval2(bIsUp, oStartTime, iFre - 1);
1504 1707 }
  1708 + },
1505 1709  
1506   - //console.log(oLbGroup);
  1710 + /**
  1711 + * 调整班次间隔。
  1712 + * @param boolean isUp 是否上行
  1713 + * @param oStartTime 开始时间对象
  1714 + * @param fre int 迭代次数
  1715 + */
  1716 + fnAdjustBcInterval: function(isUp, oStartTime, fre) {
  1717 + if (fre > 0) {
  1718 + var aBc = !oStartTime ? _fnGetBcList(isUp) : _fnGetBcList2(isUp, oStartTime); // 指定方向的班次列表
1507 1719  
1508   - var sKey;
1509   - var iQindex;
1510   - var iBindex;
1511   - var aBcLb = [];
  1720 + aBc.sort(function(o1, o2) {
  1721 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1722 + return -1;
  1723 + } else {
  1724 + return 1;
  1725 + }
  1726 + });
1512 1727  
1513   - var oLbGroup_m = {};
1514   - var aLbGroup = [];
  1728 + var i;
  1729 + var j;
1515 1730  
  1731 + var iBcCountOfGroup = 3; // 3个班次取一次计算
  1732 + var aBcOfGroup; // 3个班次列表
  1733 + var aBcIntervalOfGroup; // 班次间隔列表,如:3个班次,2个间隔
  1734 + var oBcFcTime; // 班次发车时间
1516 1735  
1517   - // 计算需要调整的连班区间
1518   - for (sKey in oLbGroup) {
1519   - iQindex = sKey.split('_')[0];
1520   - iBindex = sKey.split('_')[1];
1521   - oLbGroup_m[sKey] = [];
1522   - for (i = 0; i < oLbGroup[sKey].length - 1; i++) {
1523   - aBcLb = [];
1524   - for (j = oLbGroup[sKey][i] + 1; j <= oLbGroup[sKey][i + 1] - 1; j++) {
1525   - oLp = _internalLpArray[j];
1526   - if (oLp.getBc(iQindex, iBindex)) {
1527   - aBcLb.push(j);
  1736 + for (i = 0; i <= aBc.length - iBcCountOfGroup; i++) {
  1737 + aBcOfGroup = [];
  1738 + aBcIntervalOfGroup = [];
  1739 + for (j = i; j < i + iBcCountOfGroup; j++) {
  1740 + aBcOfGroup.push(aBc[j]);
  1741 + }
  1742 +
  1743 + for (j = 0; j < aBcOfGroup.length; j++) {
  1744 + if (j < aBcOfGroup.length - 1) {
  1745 + aBcIntervalOfGroup.push(aBcOfGroup[j + 1].getFcTimeObj().diff(
  1746 + aBcOfGroup[j].getFcTimeObj(), "m"));
1528 1747 }
1529 1748 }
1530   - if (aBcLb.length != 0 && aBcLb.length < (oLbGroup[sKey][i + 1] - oLbGroup[sKey][i] - 1)) {
1531   - aLbGroup = [];
1532   - aLbGroup.push(oLbGroup[sKey][i]);
1533   - aLbGroup.push(oLbGroup[sKey][i + 1]);
1534   - aLbGroup.push(aBcLb);
1535   - oLbGroup_m[sKey].push(aLbGroup);
  1749 +
  1750 + // 判定规则
  1751 + oBcFcTime = aBcOfGroup[1].getFcTimeObj();
  1752 +
  1753 + // 第一个班次发车时间不动,根据间隔,调整中间一个班次
  1754 + // 如果3个班次2个间隔时间差1分钟,不调整
  1755 + // 如果第一个间隔大,调整第二个班次往前1分钟
  1756 + // 如果第二个间隔大,调整第二个班次往后1分钟
  1757 +
  1758 + if (_paramObj.isTroughBc(oBcFcTime) &&
  1759 + aBcIntervalOfGroup[0] > _paramObj.getTroughMaxFcjx()) {
  1760 + aBcOfGroup[1].addMinuteToFcsj(-1);
1536 1761 }
1537   - }
1538   - }
1539 1762  
1540   - console.log(oLbGroup_m);
  1763 + //else if (_paramObj.isMPeakBc(oBcFcTime) &&
  1764 + // aBcIntervalOfGroup[0] < _paramObj.getMPeakMinFcjx()) {
  1765 + // aBcOfGroup[1].addMinuteToFcsj(1);
  1766 + //} else if (_paramObj.isMPeakBc(oBcFcTime) &&
  1767 + // aBcIntervalOfGroup[0] > _paramObj.getMPeakMaxFcjx()) {
  1768 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  1769 + //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
  1770 + // aBcIntervalOfGroup[0] < _paramObj.getEPeakMinFcjx()) {
  1771 + // aBcOfGroup[1].addMinuteToFcsj(1);
  1772 + //} else if (_paramObj.isEPeakBc(oBcFcTime) &&
  1773 + // aBcIntervalOfGroup[0] > _paramObj.getEPeakMaxFcjx()) {
  1774 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  1775 + //}
  1776 +
  1777 +
  1778 + else {
  1779 + if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  1780 + //continue;
  1781 + } else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  1782 + aBcOfGroup[1].addMinuteToFcsj(-1);
  1783 + } else {
  1784 + aBcOfGroup[1].addMinuteToFcsj(1);
  1785 + }
  1786 + }
1541 1787  
1542   - var iStartLpIndex;
1543   - var iEndLpIndex;
1544   - var iDCount;
1545   - var iDiffTime;
  1788 + //if (Math.abs(aBcIntervalOfGroup[0] - aBcIntervalOfGroup[1]) <= 1) {
  1789 + // //continue;
  1790 + //} else if (aBcIntervalOfGroup[0] > aBcIntervalOfGroup[1]) {
  1791 + // aBcOfGroup[1].addMinuteToFcsj(-1);
  1792 + //} else {
  1793 + // aBcOfGroup[1].addMinuteToFcsj(1);
  1794 + //}
1546 1795  
1547   - var iC1;
1548   - var iC2;
1549   - var oKssj;
1550 1796  
1551   - for (sKey in oLbGroup_m) {
1552   - iQindex = sKey.split('_')[0];
1553   - iBindex = sKey.split('_')[1];
  1797 + }
1554 1798  
1555   - for (i = 0; i < oLbGroup_m[sKey].length; i++) {
1556   - aLbGroup = oLbGroup_m[sKey][i];
  1799 + this.fnAdjustBcInterval(isUp, oStartTime, fre - 1);
  1800 + }
1557 1801  
1558   - iStartLpIndex = aLbGroup[0];
1559   - iEndLpIndex = aLbGroup[1];
1560   - iDCount = aLbGroup[2].length + 1;
  1802 + },
1561 1803  
1562   - iDiffTime = _internalLpArray[iEndLpIndex].getBc(iQindex, iBindex).getFcTimeObj().diff(
1563   - _internalLpArray[iStartLpIndex].getBc(iQindex, iBindex).getFcTimeObj(), 'm');
  1804 + /**
  1805 + * 调整班次间隔(平均间隔)。
  1806 + * @param bIsUp 是否上行
  1807 + * @param oStartTime 开始时间对象
  1808 + */
  1809 + fnAdjustBcInterval2_avg: function(bIsUp, oStartTime) {
  1810 + var aBc = !oStartTime ? _fnGetBcList(bIsUp) : _fnGetBcList2(bIsUp, oStartTime); // 指定方向的班次列表
  1811 + aBc.sort(function(o1, o2) {
  1812 + if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
  1813 + return -1;
  1814 + } else {
  1815 + return 1;
  1816 + }
  1817 + });
1564 1818  
1565   - iC1 = Math.floor(iDiffTime / iDCount);
1566   - iC2 = iDiffTime % iDCount;
1567   - oKssj = _internalLpArray[iStartLpIndex].getBc(iQindex, iBindex).getFcTimeObj();
  1819 + var j;
  1820 + var iCount = aBc.length - 1;
  1821 + var iC1 = Math.floor(aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") / iCount);
  1822 + var iC2 = aBc[aBc.length - 1].getFcTimeObj().diff(aBc[0].getFcTimeObj(), "m") % iCount;
  1823 + var iTempTime;
  1824 +
  1825 + for (j = 0; j < iCount - iC2; j++) {
  1826 + iTempTime = aBc[j + 1].getFcTimeObj().diff(aBc[j].getFcTimeObj(), "m");
  1827 + aBc[j + 1].addMinuteToFcsj(iC1 - iTempTime);
  1828 + }
  1829 + for (j = 0; j < iC2; j++) {
  1830 + iTempTime = aBc[iCount - iC2 + j + 1].getFcTimeObj().diff(aBc[iCount - iC2 + j].getFcTimeObj(), "m");
  1831 + aBc[iCount - iC2 + j + 1].addMinuteToFcsj(iC1 + 1 - iTempTime);
  1832 + }
1568 1833  
1569   - for (j = 1; j <= iDCount - iC2; j++) {
1570   - if (j - 1 < aLbGroup[2].length) {
1571   - oKssj = _paramObj.addMinute(oKssj, iC1);
1572   - _internalLpArray[aLbGroup[2][j - 1]].getBc(
1573   - iQindex, iBindex).setFcTimeObj(oKssj);
1574   - }
1575   - }
  1834 + },
1576 1835  
1577   - for (j = 1; j < iC2; j++) {
1578   - oKssj = _paramObj.addMinute(oKssj, iC1 + 1);
1579   - _internalLpArray[aLbGroup[2][iDCount - iC2 + j - 1]].getBc(
1580   - iQindex, iBindex).setFcTimeObj(oKssj);
  1836 + /**
  1837 + * 计算高峰平均停站时间。
  1838 + */
  1839 + fnCalcuAverPeakStopTime: function() {
  1840 + var i;
  1841 + var j;
  1842 + var aBc;
  1843 + var iBcCount = 0;
  1844 + var iSum = 0;
  1845 + for (i = 0; i < _internalLpArray.length; i++) {
  1846 + aBc = _internalLpArray[i].getBcArray();
  1847 +
  1848 + for (j = 0; j < aBc.length; j++) {
  1849 + if (!_paramObj.isTroughBc(aBc[j].getArrTimeObj())) {
  1850 + iBcCount ++;
  1851 + iSum += aBc[j].getStopTime();
1581 1852 }
  1853 + }
  1854 + }
1582 1855  
  1856 + return Math.floor(iSum / iBcCount);
  1857 + },
  1858 +
  1859 + /**
  1860 + * 计算低谷平均停站时间。
  1861 + */
  1862 + fnCalcuAverTroughStopTime: function() {
  1863 + var i;
  1864 + var j;
  1865 + var aBc;
  1866 + var iBcCount = 0;
  1867 + var iSum = 0;
  1868 + for (i = 0; i < _internalLpArray.length; i++) {
  1869 + aBc = _internalLpArray[i].getBcArray();
  1870 + for (j = 0; j < aBc.length; j++) {
  1871 + if (_paramObj.isTroughBc(aBc[j].getArrTimeObj())) {
  1872 + iBcCount ++;
  1873 + iSum += aBc[j].getStopTime();
  1874 + }
1583 1875 }
1584 1876 }
1585 1877  
  1878 + return Math.floor(iSum / iBcCount);
1586 1879 },
1587 1880  
1588 1881 //------------- 其他方法 -------------//
... ... @@ -1592,6 +1885,7 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1592 1885 fnToGanttBcArray: function() {
1593 1886 var aAllBc = [];
1594 1887 var aLpBc = [];
  1888 + var aEatBc = [];
1595 1889 var oLp;
1596 1890 var i;
1597 1891 var j;
... ... @@ -1600,6 +1894,23 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1600 1894 oLp = _internalLpArray[i];
1601 1895 aLpBc = [];
1602 1896 aLpBc = aLpBc.concat(oLp.getOtherBcArray(), oLp.getBcArray());
  1897 +
  1898 + aEatBc = [];
  1899 + // 根据班次的吃饭时间添加吃饭班次
  1900 + for (j = 0; j < aLpBc.length; j++) {
  1901 + if (aLpBc[j].fnGetEatTime() > 0) {
  1902 + aEatBc.push(_factory.createBcObj(
  1903 + oLp,
  1904 + "cf",
  1905 + !aLpBc[j].isUp(), // 和上一个班次方向相反
  1906 + 1,
  1907 + _paramObj.addMinute(aLpBc[j].getArrTimeObj(), aLpBc[j].getStopTime()), // 使用上一个班次的到达时间作为开始时间
  1908 + _paramObj
  1909 + ));
  1910 + }
  1911 + }
  1912 + aLpBc = aLpBc.concat(aEatBc);
  1913 +
1603 1914 // 按照发车时间排序
1604 1915 aLpBc.sort(function(o1, o2) {
1605 1916 if (o1.getFcTimeObj().isBefore(o2.getFcTimeObj())) {
... ... @@ -1626,5 +1937,4 @@ var InternalScheduleObj = function(paramObj, lpArray, factory) {
1626 1937 }
1627 1938  
1628 1939 };
1629   -
1630 1940 };
1631 1941 \ No newline at end of file
... ...
src/main/resources/static/pages/base/timesmodel/js/v2/main_v2.js
... ... @@ -18,7 +18,8 @@ var Main_v2 = function() {
18 18 var _fcsj = fcTimeObj;
19 19 var _bcsj = paramObj.calcuTravelTime(_fcsj, isUp);
20 20 var _arrsj = paramObj.addMinute(_fcsj, _bcsj);
21   - var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
  21 + //var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, _bcsj);
  22 + var _stoptime = paramObj.fnCalcuFixedStopNumber(_arrsj, !isUp, undefined);
22 23 var _tccid = paramObj.getTTinfoId();
23 24 var _ttinfoid = paramObj.getTTinfoId();
24 25 var _xl = paramObj.getXlId();
... ... @@ -161,6 +162,9 @@ var Main_v2 = function() {
161 162 schedule.fnAdjustGfbc(false, true); // 修正上行晚高峰
162 163 schedule.fnAdjustGfbc(false, false); // 修正下行晚高峰
163 164  
  165 + // 6、补吃饭班次
  166 + schedule.fnCalcuEatBc();
  167 +
164 168 // 4、按照车辆投入运营要求补充班次
165 169 schedule.fnCalcuLpBc_yy();
166 170  
... ... @@ -168,19 +172,26 @@ var Main_v2 = function() {
168 172 schedule.fnCalcuLpBx_5_2();
169 173 schedule.fnCalcuLpBx_other();
170 174  
171   - // 6、补吃饭班次
172   - schedule.fnCalcuEatBc();
  175 + // 7、祛除上标线开头有删除标记的班次
  176 + schedule.fnRemoveDelFirstFlagBc();
173 177  
174   - // 7、祛除有删除标记的班次
175   - schedule.fnRemoveDelFlagBc();
  178 + // TODO:8、调整路牌班次间隔
  179 + schedule.fnAdjustLpBcInterval(1);
176 180  
177   - // 8、调整纵向班次间隔
178   - schedule.fnAdjust_vertical_bc_interval();
179   - // TODO:横向调整
  181 + // TODO:9、调整纵向班次间隔
  182 + schedule.fnAdjustBcInterval(true, false, 10);
  183 + schedule.fnAdjustBcInterval(false, false, 10);
180 184  
181   - // 9、确定末班车
  185 + // 10、确定末班车
182 186 schedule.fnCalcuLastBc();
183 187  
  188 + // 11、祛除上标线结尾有删除标记的班次
  189 + schedule.fnRemoveDelLastFlagBc();
  190 +
  191 + // TODO:12、平均化指定时间后的班次列表间隔
  192 + schedule.fnAdjustBcInterval2_avg(true, _paramObj.toTimeObj("19:50"));
  193 + schedule.fnAdjustBcInterval2_avg(false, _paramObj.toTimeObj("19:50"));
  194 +
184 195 // 10、补进出场例保班次
185 196 schedule.fnCalcuOtherBc();
186 197  
... ...
src/main/resources/static/pages/electricity/list/list.html
... ... @@ -190,7 +190,12 @@
190 190  
191 191 </td>
192 192 <td>
193   - {{obj.jsy}}/{{obj.name}}
  193 + {{if obj.jsy=='' || obj.jsy==null }}
  194 + <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input>
  195 + <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button>
  196 + {{else}}
  197 + {{obj.jsy}}/{{obj.name}}
  198 + {{/if}}
194 199 </td>
195 200 <td>
196 201  
... ... @@ -527,6 +532,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
527 532 });
528 533 var bodyHtm = template('dlb_list_temp', {list:data});
529 534 $('#datatable_dlb tbody').html(bodyHtm);
  535 + $('.btn-jsyUpdate').on('click', jsyUpdate);
530 536 layer.close(l);
531 537 $get('/dlb/sumYlb',params,function(returns){
532 538 $("#sumJzl").html(returns.jzl);
... ... @@ -556,6 +562,17 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
556 562 });
557 563 }
558 564  
  565 + function jsyUpdate(){
  566 + var id = $(this).data('id');
  567 + var jsy=$('.in_carpark_jsy[data-id='+id+']', '#dl_oil_list').val();
  568 + $get('/dlb/updateJsy',{id:id,jsy:jsy}, function(result){
  569 + layer.msg('修改成功.');
  570 + var params = getParamsList();
  571 + page = 0;
  572 + jsDoQuery(params, true);
  573 + });
  574 +
  575 + }
559 576 //页面计算防止精度丢失
560 577 var accAdd = function (a, b) {
561 578 var c, d, e;
... ...
src/main/resources/static/pages/forms/mould/oilListMonth.xls
No preview for this file type
src/main/resources/static/pages/forms/mould/onlinelist.xls 0 → 100644
No preview for this file type
src/main/resources/static/pages/forms/statement/busInterval.html
... ... @@ -412,6 +412,32 @@
412 412 });
413 413 }
414 414  
  415 + /**
  416 + * 将模块List 转换为树结构
  417 + * @param arr
  418 + * @returns {Array}
  419 + */
  420 + function createTreeData(arr){
  421 + var treeData = [];
  422 + var len = arr.length;
  423 + for(var i = 0; i < len; i ++){
  424 + var pId = arr[i].pId;
  425 + arr[i].text = arr[i].name;
  426 + if(!pId){
  427 + treeData.push(arr[i]);
  428 + }
  429 +
  430 + for(var j = 0; j < len; j ++){
  431 + if(pId == arr[j].id){
  432 + if(!arr[j].children)
  433 + arr[j].children = [];
  434 + arr[j].children.push(arr[i]);
  435 + break;
  436 + }
  437 + }
  438 + }
  439 + return treeData;
  440 + }
415 441  
416 442 function _w_table_rowspan(_w_table_id, _w_table_colnum){
417 443 _w_table_firsttd = "";
... ...
src/main/resources/static/pages/forms/statement/lbStatuAnaly.html
... ... @@ -41,7 +41,7 @@
41 41 <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="6" checked="true"/>缺车
42 42 <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="7" checked="true"/>客稀
43 43 <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="8" checked="true"/>气候
44   - <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="9" checked="true"/>外援
  44 + <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="9" checked="true"/>援外
45 45 <input class="form-control" type="checkbox" name="reason" style="width: 20px;" value="10" checked="true"/>其他
46 46 </div>
47 47 <div style="margin-top: 5px"></div>
... ... @@ -438,6 +438,32 @@
438 438 });
439 439 }
440 440  
  441 + /**
  442 + * 将模块List 转换为树结构
  443 + * @param arr
  444 + * @returns {Array}
  445 + */
  446 + function createTreeData(arr){
  447 + var treeData = [];
  448 + var len = arr.length;
  449 + for(var i = 0; i < len; i ++){
  450 + var pId = arr[i].pId;
  451 + arr[i].text = arr[i].name;
  452 + if(!pId){
  453 + treeData.push(arr[i]);
  454 + }
  455 +
  456 + for(var j = 0; j < len; j ++){
  457 + if(pId == arr[j].id){
  458 + if(!arr[j].children)
  459 + arr[j].children = [];
  460 + arr[j].children.push(arr[i]);
  461 + break;
  462 + }
  463 + }
  464 + }
  465 + return treeData;
  466 + }
441 467  
442 468 function _w_table_rowspan(_w_table_id, _w_table_colnum){
443 469 _w_table_firsttd = "";
... ... @@ -492,7 +518,7 @@
492 518 {{if reason[6].checked == true}}<th colspan="3">缺车</th>{{/if}}
493 519 {{if reason[7].checked == true}}<th colspan="3">客稀</th>{{/if}}
494 520 {{if reason[8].checked == true}}<th colspan="3">气候</th>{{/if}}
495   - {{if reason[9].checked == true}}<th colspan="3">外援</th>{{/if}}
  521 + {{if reason[9].checked == true}}<th colspan="3">援外</th>{{/if}}
496 522 {{if reason[10].checked == true}}<th colspan="3">其他</th>{{/if}}
497 523 </tr>
498 524 <tr>
... ...
src/main/resources/static/pages/forms/statement/lineTimeAnaly.html
... ... @@ -478,6 +478,32 @@
478 478 });
479 479 }
480 480  
  481 + /**
  482 + * 将模块List 转换为树结构
  483 + * @param arr
  484 + * @returns {Array}
  485 + */
  486 + function createTreeData(arr){
  487 + var treeData = [];
  488 + var len = arr.length;
  489 + for(var i = 0; i < len; i ++){
  490 + var pId = arr[i].pId;
  491 + arr[i].text = arr[i].name;
  492 + if(!pId){
  493 + treeData.push(arr[i]);
  494 + }
  495 +
  496 + for(var j = 0; j < len; j ++){
  497 + if(pId == arr[j].id){
  498 + if(!arr[j].children)
  499 + arr[j].children = [];
  500 + arr[j].children.push(arr[i]);
  501 + break;
  502 + }
  503 + }
  504 + }
  505 + return treeData;
  506 + }
481 507  
482 508 });
483 509  
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly.html
... ... @@ -327,6 +327,32 @@
327 327 });
328 328 }
329 329  
  330 + /**
  331 + * 将模块List 转换为树结构
  332 + * @param arr
  333 + * @returns {Array}
  334 + */
  335 + function createTreeData(arr){
  336 + var treeData = [];
  337 + var len = arr.length;
  338 + for(var i = 0; i < len; i ++){
  339 + var pId = arr[i].pId;
  340 + arr[i].text = arr[i].name;
  341 + if(!pId){
  342 + treeData.push(arr[i]);
  343 + }
  344 +
  345 + for(var j = 0; j < len; j ++){
  346 + if(pId == arr[j].id){
  347 + if(!arr[j].children)
  348 + arr[j].children = [];
  349 + arr[j].children.push(arr[i]);
  350 + break;
  351 + }
  352 + }
  353 + }
  354 + return treeData;
  355 + }
330 356  
331 357 function showPagination(data){
332 358 //分页
... ...
src/main/resources/static/pages/forms/statement/scheduleAnaly_sum.html
... ... @@ -335,6 +335,33 @@
335 335 });
336 336 }
337 337  
  338 + /**
  339 + * 将模块List 转换为树结构
  340 + * @param arr
  341 + * @returns {Array}
  342 + */
  343 + function createTreeData(arr){
  344 + var treeData = [];
  345 + var len = arr.length;
  346 + for(var i = 0; i < len; i ++){
  347 + var pId = arr[i].pId;
  348 + arr[i].text = arr[i].name;
  349 + if(!pId){
  350 + treeData.push(arr[i]);
  351 + }
  352 +
  353 + for(var j = 0; j < len; j ++){
  354 + if(pId == arr[j].id){
  355 + if(!arr[j].children)
  356 + arr[j].children = [];
  357 + arr[j].children.push(arr[i]);
  358 + break;
  359 + }
  360 + }
  361 + }
  362 + return treeData;
  363 + }
  364 +
338 365 function initCl(){
339 366 $('#nbbm').select2({
340 367 placeholder: '搜索车辆...',
... ...
src/main/resources/static/pages/forms/statement/timeAndSpeed.html
... ... @@ -480,6 +480,33 @@
480 480 });
481 481 }
482 482  
  483 + /**
  484 + * 将模块List 转换为树结构
  485 + * @param arr
  486 + * @returns {Array}
  487 + */
  488 + function createTreeData(arr){
  489 + var treeData = [];
  490 + var len = arr.length;
  491 + for(var i = 0; i < len; i ++){
  492 + var pId = arr[i].pId;
  493 + arr[i].text = arr[i].name;
  494 + if(!pId){
  495 + treeData.push(arr[i]);
  496 + }
  497 +
  498 + for(var j = 0; j < len; j ++){
  499 + if(pId == arr[j].id){
  500 + if(!arr[j].children)
  501 + arr[j].children = [];
  502 + arr[j].children.push(arr[i]);
  503 + break;
  504 + }
  505 + }
  506 + }
  507 + return treeData;
  508 + }
  509 +
483 510 function _w_table_rowspan(_w_table_id, _w_table_colnum){
484 511 _w_table_firsttd = "";
485 512 _w_table_currenttd = "";
... ...
src/main/resources/static/pages/forms/statement/waybill.html
... ... @@ -359,7 +359,8 @@
359 359 });
360 360 });
361 361 $get('/realSchedule/exportWaybillMore',{date:date,line:line,strs:JSON.stringify(param)},function(result){
362   - window.open("/downloadFile/downloadList?fileName="+result.fileName);
  362 +// window.open("/downloadFile/downloadList?fileName="+result.fileName); //下载压缩包
  363 + window.open("/downloadFile/download?fileName="+result.fileName);
363 364 });
364 365 });
365 366  
... ...
src/main/resources/static/pages/history_sch/edit/history_sch_maintain.html
... ... @@ -38,6 +38,8 @@
38 38 </div>
39 39 <button class="uk-button">检索</button>
40 40 <a class="add_lp_link" title="先点击检索后再临加路牌"><i class="uk-icon-plus"></i> 临加路牌</a>
  41 + <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;">
  42 + 重新统计</button>
41 43 </fieldset>
42 44 </form>
43 45 </div>
... ... @@ -476,6 +478,41 @@
476 478  
477 479 $('[name=xlBm_eq]', f).on('change', clearLpSelect);
478 480 //clearLpSelect
  481 +
  482 +
  483 + /**
  484 + * 重新统计
  485 + */
  486 + $('#reCountBtn', modal).on('click', function () {
  487 + var lineSelect = $('[name=xlBm_eq]', modal);
  488 + var rq = $('.h-s-time li.uk-active', modal).text(),
  489 + lineName = lineSelect[0].options[lineSelect[0].selectedIndex].text,//$('.h-s-line li.uk-active', modal).text(),
  490 + lineCode = lineSelect.val();
  491 +
  492 + var that = this;
  493 + alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () {
  494 + $(that).attr('disabled', 'disabled');
  495 + $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>');
  496 +
  497 +
  498 + var reCountEp = EventProxy.create('ylbUpdate', function () {
  499 + $('i.uk-icon-spin', that).remove();
  500 + $(that).removeAttr('disabled');
  501 + notify_succ('重新统计成功!');
  502 + });
  503 +
  504 + //统计路单 -娄高峰
  505 + /*gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () {
  506 + reCountEp.emitLater('calcWaybill');
  507 + });*/
  508 +
  509 + //统计油 -廖磊
  510 + gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () {
  511 + reCountEp.emitLater('ylbUpdate');
  512 + });
  513 +
  514 + }, '我确定');
  515 + });
479 516 })();
480 517 </script>
481 518 </div>
482 519 \ No newline at end of file
... ...
src/main/resources/static/pages/mforms/online/online.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px;
  14 + text-align: center;}
  15 +
  16 + .table > tbody + tbody {
  17 + border-top: 1px solid; }
  18 + .table>tbody>tr>td, .table>tbody>tr>th, .table>tfoot>tr>td, .table>tfoot>tr>th, .table>thead>tr>td, .table>thead>tr>th{ text-align: center; }
  19 +.table-checkable tr > th:first-child, .table-checkable tr > td:first-child {
  20 + text-align: center;
  21 + max-width: initial;
  22 + min-width: 40px;
  23 + padding-left: 0;
  24 + padding-right: 0;
  25 +}
  26 +
  27 +</style>
  28 +
  29 +<div class="page-head">
  30 + <div class="page-title">
  31 + <h1>车辆在线率统计表</h1>
  32 + </div>
  33 +</div>
  34 +
  35 +<div class="row">
  36 + <div class="col-md-12">
  37 + <div class="portlet light porttlet-fit bordered">
  38 + <div class="portlet-title">
  39 + <form class="form-inline" action="" method="post">
  40 + <div style="display: inline-block; margin-left: 20px;" id="gsdmDiv_turn">
  41 + <span class="item-label" style="width: 80px;">公司: </span>
  42 + <select class="form-control" name="company" id="gsdmTurn" style="width: 140px;"></select>
  43 + </div>
  44 + <div style="display: inline-block; margin-left: 20px;" id="fgsdmDiv_turn">
  45 + <span class="item-label" style="width: 80px;">分公司: </span>
  46 + <select class="form-control" name="subCompany" id="fgsdmTurn" style="width: 140px;"></select>
  47 + </div>
  48 + <div style="display: inline-block; margin-left: 15px;">
  49 + <span class="item-label" style="width: 80px;">线路: </span>
  50 + <select class="form-control" name="line" id="line" style="width: 120px;"></select>
  51 + </div>
  52 + <div style="display: inline-block;margin-left: 15px;">
  53 + <span class="item-label" style="width: 80px;">日期: </span>
  54 + <input class="form-control" type="text" id="date" style="width: 120px;"/>
  55 + </div>
  56 +
  57 + <div class="form-group">
  58 + <input class="btn btn-default" type="button" id="query" value="筛选"/>
  59 + <input class="btn btn-default" type="button" id="export" value="导出"/>
  60 + </div>
  61 + </form>
  62 + </div>
  63 + <div class="portlet-body">
  64 + <div class="table-container" style="margin-top: 20px;overflow:auto;min-width: 1000px">
  65 + <table class="table table-bordered table-hover table-checkable" id="forms1">
  66 + <thead>
  67 + <tr>
  68 + <th colspan="6">车辆在线率统计表</th>
  69 + </tr>
  70 + <tr>
  71 + <td>日期</td>
  72 + <td>线路</td>
  73 + <td>权证配车数</td>
  74 + <td>实际出车数</td>
  75 + <td>在线车辆数</td>
  76 + <td>在线率</td>
  77 + </tr>
  78 + </thead>
  79 + <tbody id="tbody">
  80 +
  81 + </tbody>
  82 + </table>
  83 + </div>
  84 + </div>
  85 + </div>
  86 + </div>
  87 +</div>
  88 +
  89 +<script>
  90 + $(function(){
  91 + // 关闭左侧栏
  92 + if (!$('body').hasClass('page-sidebar-closed'))
  93 + $('.menu-toggler.sidebar-toggler').click();
  94 +
  95 + $("#date").datetimepicker({
  96 + format : 'YYYY-MM-DD',
  97 + locale : 'zh-cn'
  98 + });
  99 +
  100 + var d = new Date();
  101 + var year = d.getFullYear();
  102 + var month = d.getMonth() + 1;
  103 + var day = d.getDate();
  104 + if(month < 10)
  105 + month = "0" + month;
  106 + if(day < 10)
  107 + day = "0" + day;
  108 + $("#date").val(year + "-" + month + "-" + day);
  109 +
  110 + var fage=false;
  111 + var xlList;
  112 + var obj = [];
  113 +
  114 + $.get('/report/lineList',function(result){
  115 + xlList=result;
  116 + $.get('/user/companyData', function(result){
  117 + obj = result;
  118 + var options = '';
  119 + for(var i = 0; i < obj.length; i++){
  120 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  121 + }
  122 +
  123 + if(obj.length ==0){
  124 + $("#gsdmDiv_turn").css('display','none');
  125 + }else if(obj.length ==1){
  126 + $("#gsdmDiv_turn").css('display','none');
  127 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  128 + $('#fgsdmDiv_turn').css('display','none');
  129 + }
  130 + $('#gsdmTurn').html(options);
  131 + updateCompany();
  132 + });
  133 + })
  134 + $("#gsdmTurn").on("change",updateCompany);
  135 + function updateCompany(){
  136 + var company = $('#gsdmTurn').val();
  137 + var options = '';
  138 + for(var i = 0; i < obj.length; i++){
  139 + if(obj[i].companyCode == company){
  140 + var children = obj[i].children;
  141 + for(var j = 0; j < children.length; j++){
  142 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  143 + }
  144 + }
  145 + }
  146 + $('#fgsdmTurn').html(options);
  147 + }
  148 +
  149 + var tempData = {};
  150 + $.get('/report/lineList',function(xlList){
  151 + var data = [];
  152 +// data.push({id: " ", text: "全部线路"});
  153 + $.get('/user/companyData', function(result){
  154 + for(var i = 0; i < result.length; i++){
  155 + var companyCode = result[i].companyCode;
  156 + var children = result[i].children;
  157 + for(var j = 0; j < children.length; j++){
  158 + var code = children[j].code;
  159 + for(var k=0;k < xlList.length;k++ ){
  160 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  161 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  162 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  163 + }
  164 + }
  165 + }
  166 + }
  167 + initPinYinSelect2('#line',data,'');
  168 +
  169 + });
  170 + });
  171 +
  172 + $("#line").on("change", function(){
  173 + if($("#line").val() == " "){
  174 + $("#gsdmTurn").attr("disabled", false);
  175 + $("#fgsdmTurn").attr("disabled", false);
  176 + } else {
  177 + var temp = tempData[$("#line").val()].split(":");
  178 + $("#gsdmTurn").val(temp[0]);
  179 + updateCompany();
  180 + $("#fgsdmTurn").val(temp[1]);
  181 + $("#gsdmTurn").attr("disabled", true);
  182 + $("#fgsdmTurn").attr("disabled", true);
  183 + }
  184 + });
  185 +
  186 + var line;
  187 + var date;
  188 + $("#query").on("click",function(){
  189 + line = $("#line").val();
  190 + date=$("#date").val();
  191 + if(date!=''){
  192 + $get('/report/online',
  193 + { line:line,date:date,type:'query'},function(result){
  194 + // 把数据填充到模版中
  195 + var tbodyHtml = template('online',result);
  196 + // 把渲染好的模版html文本追加到表格中
  197 + $('#tbody').html(tbodyHtml);
  198 + });
  199 +
  200 + }else{
  201 + layer.msg("请选择时间!");
  202 + }
  203 + });
  204 +
  205 + $("#export").on("click",function(){
  206 + line = $("#line").val();
  207 + date=$("#date").val();
  208 + $get('/report/online',{line:line,date:date,type:'export'},function(result){
  209 + window.open("/downloadFile/download?fileName=车辆在线率统计");
  210 + });
  211 + });
  212 + });
  213 +</script>
  214 +<script type="text/html" id="online">
  215 + <tr>
  216 + <td>{{date}}</td>
  217 + <td>{{xlName}}</td>
  218 + <td>{{qzpcs}}</td>
  219 + <td>{{ccs}}</td>
  220 + <td>{{zxcl}}</td>
  221 + <td>{{zxl}}</td>
  222 + </tr>
  223 +</script>
... ...
src/main/resources/static/pages/mforms/singledatas/singledata.html
... ... @@ -192,7 +192,7 @@
192 192 var tjtype=$("#tjtype").val();
193 193 var params = {};
194 194 var i = layer.load(2);
195   - $get("/mcy_forms/singledata",{ gsdmSing:gsdmSing,fgsdmSing:fgsdmSing, line:line,startDate:startDate,lpName:lpName,tjtype:tjtype},function(result){
  195 + $get("/mcy_forms/singledatatj",{ gsdmSing:gsdmSing,fgsdmSing:fgsdmSing, line:line,startDate:startDate,lpName:lpName,tjtype:tjtype},function(result){
196 196 layer.close(i);
197 197 var singledata = template('singledata',{list:result});
198 198 // 把渲染好的模版html文本追加到表格中
... ... @@ -209,7 +209,7 @@
209 209 var gsdmSing = $("#gsdmSing").val();
210 210 var fgsdmSing = $("#fgsdmSing").val();
211 211 var tjtype=$("#tjtype").val();
212   - $get('/mcy_export/singledataExport',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,type:'export'},function(result){
  212 + $get('/mcy_export/singledataExportTj',{gsdmSing:gsdmSing,fgsdmSing:fgsdmSing,line:line,startDate:startDate,endDate:endDate,tjtype:tjtype,type:'export'},function(result){
213 213 window.open("/downloadFile/download?fileName=路单数据"+moment(startDate).format("YYYYMMDD"));
214 214 });
215 215 });
... ...
src/main/resources/static/pages/oil/history/history.html 0 → 100644
  1 +<style type="text/css">
  2 + .table-bordered {
  3 + border: 1px solid; }
  4 + .table-bordered > thead > tr > th,
  5 + .table-bordered > thead > tr > td,
  6 + .table-bordered > tbody > tr > th,
  7 + .table-bordered > tbody > tr > td,
  8 + .table-bordered > tfoot > tr > th,
  9 + .table-bordered > tfoot > tr > td {
  10 + border: 1px solid; }
  11 + .table-bordered > thead > tr > th,
  12 + .table-bordered > thead > tr > td {
  13 + border-bottom-width: 2px; }
  14 +
  15 + .table > tbody + tbody {
  16 + border-top: 1px solid; }
  17 +</style>
  18 +
  19 +<div class="page-head">
  20 + <div class="page-title">
  21 + <h1>重新统计</h1>
  22 + </div>
  23 +</div>
  24 +
  25 +<div class="row">
  26 + <div class="col-md-12">
  27 + <div class="portlet light porttlet-fit bordered">
  28 + <div class="portlet-title">
  29 + <form class="form-inline" action="">
  30 + <div style="display: inline-block; margin-left: 33px;" id="gsdmDiv_daily">
  31 + <span class="item-label" style="width: 80px;">公司: </span>
  32 + <select class="form-control" name="company" id="gsdmDaily" style="width: 180px;"></select>
  33 + </div>
  34 + <div style="display: inline-block; margin-left: 24px;" id="fgsdmDiv_daily">
  35 + <span class="item-label" style="width: 80px;">分公司: </span>
  36 + <select class="form-control" name="subCompany" id="fgsdmDaily" style="width: 180px;"></select>
  37 + </div>
  38 + <div style="margin-top: 2px"></div>
  39 + <div style="display: inline-block;margin-left: 33px;">
  40 + <span class="item-label" style="width: 80px;">线路: </span>
  41 + <select class="form-control" name="line" id="line" style="width: 180px;"></select>
  42 + </div>
  43 + <div style="display: inline-block;margin-left: 24px;">
  44 + <span class="item-label" style="width: 80px;">&nbsp;时间: </span>
  45 + <select class="form-control" id="date" style="width: 180px;">
  46 + <option value="2017-11-07">2017-11-07</option>
  47 + </select>
  48 + </div>
  49 + <div class="form-group">
  50 + <input class="btn btn-default" type="button" id="query" value="重新统计"/>
  51 + </div>
  52 + </form>
  53 + </div>
  54 + </div>
  55 + </div>
  56 +</div>
  57 +
  58 +<script>
  59 + $(function(){
  60 +
  61 + // 关闭左侧栏
  62 + if (!$('body').hasClass('page-sidebar-closed'))
  63 + $('.menu-toggler.sidebar-toggler').click();
  64 +
  65 + function GetDateStr(AddDayCount) {
  66 + var dd = new Date();
  67 + dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
  68 + var y = dd.getFullYear();
  69 + var m = dd.getMonth()+1;//获取当前月份的日期
  70 + if(m<10){
  71 + m="0" + m;
  72 + }
  73 +
  74 + var d = dd.getDate();
  75 + if(d<10){
  76 + d="0" +d;
  77 + }
  78 + return y+"-"+m+"-"+d;
  79 + }
  80 +// var optionsDate = '';
  81 +// for(var i = -1; i > -4; i--){
  82 +// optionsDate += '<option value="2017-11-01">'+2017-11-01+'</option>';
  83 +// }
  84 +// $('#date').html(optionsDate);
  85 + var fage=false;
  86 + var xlList;
  87 + var obj = [];
  88 +
  89 +
  90 + $.get('/report/lineList',function(result){
  91 + xlList=result;
  92 + $.get('/user/companyData', function(result){
  93 + obj = result;
  94 + var options = '';
  95 + for(var i = 0; i < obj.length; i++){
  96 + options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
  97 + }
  98 +
  99 + if(obj.length ==0){
  100 + $("#gsdmDiv_daily").css('display','none');
  101 + }else if(obj.length ==1){
  102 + $("#gsdmDiv_daily").css('display','none');
  103 + if(obj[0].children.length == 1 || obj[0].children.length ==0)
  104 + $('#fgsdmDiv_daily').css('display','none');
  105 + }
  106 + $('#gsdmDaily').html(options);
  107 + updateCompany();
  108 + });
  109 + })
  110 + $("#gsdmDaily").on("change",updateCompany);
  111 + function updateCompany(){
  112 + var company = $('#gsdmDaily').val();
  113 + var options = '';
  114 + for(var i = 0; i < obj.length; i++){
  115 + if(obj[i].companyCode == company){
  116 + var children = obj[i].children;
  117 + for(var j = 0; j < children.length; j++){
  118 + options += '<option value="'+children[j].code+'">'+children[j].name+'</option>';
  119 + }
  120 + }
  121 + }
  122 + $('#fgsdmDaily').html(options);
  123 +// initXl();
  124 + }
  125 +
  126 +
  127 + var tempData = {};
  128 + $.get('/report/lineList',function(xlList){
  129 + var data = [];
  130 +// data.push({id: " ", text: "全部线路"});
  131 + $.get('/user/companyData', function(result){
  132 + for(var i = 0; i < result.length; i++){
  133 + var companyCode = result[i].companyCode;
  134 + var children = result[i].children;
  135 + for(var j = 0; j < children.length; j++){
  136 + var code = children[j].code;
  137 + for(var k=0;k < xlList.length;k++ ){
  138 + if(xlList[k]["fgsbm"]==code && xlList[k]["gsbm"]==companyCode){
  139 + data.push({id: xlList[k]["xlbm"], text: xlList[k]["xlname"]});
  140 + tempData[xlList[k]["xlbm"]] = companyCode+":"+code;
  141 + }
  142 + }
  143 + }
  144 + }
  145 + initPinYinSelect2('#line',data,'');
  146 +
  147 + });
  148 + });
  149 +
  150 + $("#line").on("change", function(){
  151 + if($("#line").val() == " "){
  152 + $("#gsdmDaily").attr("disabled", false);
  153 + $("#fgsdmDaily").attr("disabled", false);
  154 + } else {
  155 + var temp = tempData[$("#line").val()].split(":");
  156 + $("#gsdmDaily").val(temp[0]);
  157 + updateCompany();
  158 + $("#fgsdmDaily").val(temp[1]);
  159 + $("#gsdmDaily").attr("disabled", true);
  160 + $("#fgsdmDaily").attr("disabled", true);
  161 + }
  162 + });
  163 +
  164 +
  165 + var line;
  166 + var date;
  167 + var gsdmDaily;
  168 + var fgsdmDaily;
  169 + $("#query").on("click",function(){
  170 + if($("#date").val() == null || $("#date").val().trim().length == 0){
  171 + layer.msg("请选择时间");
  172 + return;
  173 + }
  174 + line = $("#line").val();
  175 + date = $("#date").val();
  176 + gsdmDaily=$("#gsdmDaily").val();
  177 + fgsdmDaily = $("#fgsdmDaily").val();
  178 + $post('/ylb/updateHistory', {date:date,line:line,gsdm:gsdmDaily,fgsdm:fgsdmDaily},
  179 + function (result) {
  180 + layer.msg("重新统计成功");
  181 + });
  182 + });
  183 +
  184 +});
  185 +</script>
... ...
src/main/resources/static/pages/oil/list_ph.html
... ... @@ -6,223 +6,228 @@
6 6 }
7 7  
8 8 </style>
9   -<div class="page-head">
10   - <div class="page-title">
11   - <h1>进出场存油量</h1>
12   - </div>
13   -</div>
14   -
15   -<ul class="page-breadcrumb breadcrumb">
16   - <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
17   - <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
18   - <li><span class="active">进出场存油量</span></li>
19   -</ul>
20   -<div id="ll_oil_list"
21   - class=" row col-md-12 portlet light porttlet-fit portlet-datatable bordered" style="height: calc(100% - 100px);background-color: #fff">
22   - <!-- Begin: life time stats -->
23   - <div class="portlet-title" >
24   - <div class="caption">
25   - <i class="fa fa-fire-extinguisher"></i> <span
26   - class="caption-subject font-dark sbold uppercase">进出场存油量表</span>
27   - </div>
28   - <div class="actions">
29   - <a class="btn btn-circle blue" href="add.html" data-pjax><i
30   - class="fa fa-plus"></i> 添加</a>
31   - <button type="button" class="btn btn-circle blue removeButton" id="removeButton">
32   - <i class="fa fa-trash-o"></i> 删除
33   - </button>
34   - <button type="button" class="btn btn-circle blue sortButton" id="sortButton">
35   - <i class="fa fa-minus-square"></i> 拆分
36   - </button>
37   - <button type="button" class="btn btn-circle blue saveButton" id="saveButton">
38   - <i class="fa fa-check-circle"></i> 保存
39   - </button>
40   - <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
41   - <div class="btn-group">
42   - <a class="btn red btn-outline btn-circle" href="javascript:;"
43   - data-toggle="dropdown"> <i class="fa fa-share"></i> <span
44   - class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
45   - </a>
46   - <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
47   - <li><a href="javascript:;" data-action="0" class="tool-action"
48   - id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息
49   - </a></li>
50   - <li><a href="javascript:;" data-action="1" class="tool-action"
51   - id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场)
52   - </a></li>
53   - <li><a href="javascript:;" id="checkYl" data-action="3"
54   - class="tool-action"> <i class="fa fa-gg-circle"></i>
55   - 核对加注量(有加油无里程)
56   - </a></li>
57   - <li class="divider"></li>
58   - <li><a href="javascript:;" data-action="3" class="tool-action"
59   - id="export"> <i class="fa fa-file-excel-o"></i> 导出Excel
60   - </a></li>
61   - </ul>
  9 + <div class="page-head">
  10 + <div class="page-title">
  11 + <h1>进出场存油量</h1>
  12 + </div>
  13 + </div>
  14 +
  15 + <ul class="page-breadcrumb breadcrumb">
  16 + <li><a href="/pages/home.html" data-pjax>首页</a> <i class="fa fa-circle"></i></li>
  17 + <li><span class="active">用油管理</span> <i class="fa fa-circle"></i></li>
  18 + <li><span class="active">进出场存油量</span></li>
  19 + </ul>
  20 + <div id="ll_oil_list"
  21 + class=" row col-md-12 portlet light porttlet-fit portlet-datatable bordered" style="height: calc(100% - 100px);background-color: #fff">
  22 + <!-- Begin: life time stats -->
  23 + <div class="portlet-title" >
  24 + <div class="caption">
  25 + <i class="fa fa-fire-extinguisher"></i> <span
  26 + class="caption-subject font-dark sbold uppercase">进出场存油量表</span>
  27 + </div>
  28 + <div class="actions">
  29 + <a class="btn btn-circle blue" href="add.html" data-pjax><i
  30 + class="fa fa-plus"></i> 添加</a>
  31 + <button type="button" class="btn btn-circle blue removeButton" id="removeButton">
  32 + <i class="fa fa-trash-o"></i> 删除
  33 + </button>
  34 + <button type="button" class="btn btn-circle blue sortButton" id="sortButton">
  35 + <i class="fa fa-minus-square"></i> 拆分
  36 + </button>
  37 + <button type="button" class="btn btn-circle blue saveButton" id="saveButton">
  38 + <i class="fa fa-check-circle"></i> 保存
  39 + </button>
  40 + <!-- <button type="button" class="btn btn-circle red" disabled="disabled" id="removeButton"><i class="fa fa-trash"></i> 删除用户</button> -->
  41 + <div class="btn-group">
  42 + <a class="btn red btn-outline btn-circle" href="javascript:;"
  43 + data-toggle="dropdown"> <i class="fa fa-share"></i> <span
  44 + class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
  45 + </a>
  46 + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
  47 + <li><a href="javascript:;" data-action="0" class="tool-action"
  48 + id="obtain"> <i class="fa fa-hourglass-half"></i> 获取加/存油信息
  49 + </a></li>
  50 + <li><a href="javascript:;" data-action="1" class="tool-action"
  51 + id="outAndIn"> <i class="fa fa-pencil"></i> 油耗计算(进场=出场)
  52 + </a></li>
  53 + <li><a href="javascript:;" id="checkYl" data-action="3"
  54 + class="tool-action"> <i class="fa fa-gg-circle"></i>
  55 + 核对加注量(有加油无里程)
  56 + </a></li>
  57 + <li class="divider"></li>
  58 + <li><a href="javascript:;" data-action="3" class="tool-action"
  59 + id="export"> <i class="fa fa-file-excel-o"></i> 导出Excel
  60 + </a></li>
  61 +
  62 +<!-- <li class="divider"></li> -->
  63 +<!-- <li><a href="javascript:;" data-action="3" class="tool-action" -->
  64 +<!-- id="cxtj"> <i class="fa fa-file-excel-o"></i> 重新统计 -->
  65 +<!-- </a></li> -->
  66 + </ul>
  67 + </div>
  68 + </div>
  69 + <div>
  70 + <table
  71 + class="table table-striped table-bordered table-hover table-checkable"
  72 + id="datatable_ylb" style="table-layout: fixed;margin-bottom: 0px">
  73 + <thead>
  74 + <tr role="row" class="filter">
  75 + <td colspan="2">
  76 + <div style="float: right;">&nbsp;公司&nbsp;</div>
  77 + </td>
  78 + <td colspan="3">
  79 + <div style="float: left; width: 150px">
  80 + <select class="form-control" name="ssgsdm_like"
  81 + id="ylbListGsdmId"></select>
  82 + </div>
  83 + </td>
  84 + <td colspan="2">
  85 + <div style="float: right;">&nbsp;分公司&nbsp;</div>
  86 + </td>
  87 + <td colspan="4">
  88 + <div style="float: left;">
  89 + <select class="form-control" name="fgsdm_like"
  90 + id="ylbListFgsdmId" style="width: 150px"></select>
  91 + </div>
  92 + </td>
  93 + <td>
  94 + <div style="float: right;">日期</div>
  95 + </td>
  96 + <td colspan="3">
  97 + <div style="float: left;">
  98 + <input type="text" style="width: 120px" name="rq" id="rq" />
  99 + </div>
  100 + </td>
  101 + <td rowspan="2" colspan="2">
  102 + <div style="float: left;">
  103 + &nbsp;
  104 + <button
  105 + class="btn btn-sm green btn-outline filter-submit margin-bottom"
  106 + style="margin-right: 0px">
  107 + <i class="fa fa-search"></i> 搜索
  108 + </button>
  109 + <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
  110 + <!-- <i class="fa fa-times"></i> 重置 -->
  111 + <!-- </button> -->
  112 +
  113 + </div>
  114 + </td>
  115 + </tr>
  116 + <tr class="filter2">
  117 + <td colspan="2">
  118 + <div style="float: right;">&nbsp;线路</div>
  119 + </td>
  120 + <td colspan="3">
  121 + <div style="float: left;">
  122 + <select class="form-control" name="xlbm_like" id="xlbm"
  123 + style="width: 150px;"></select>
  124 + </div>
  125 + </td>
  126 + <td colspan="2">
  127 + <div style="float: right;">&nbsp;内部编码</div>
  128 + </td>
  129 + <td colspan="4">
  130 + <div style="float: left;">
  131 + <select class="form-control" name="nbbm_eq" id="nbbm"
  132 + style="width: 120px;"></select>
  133 + </div>
  134 + <div style="float: left;">
  135 + <button class="btn btn-sm #000 btn-outline filter-cancel"
  136 + style="margin-right: 0px">
  137 + <i class="fa fa-times"></i>
  138 + </button>
  139 + </div>
  140 + </td>
  141 + <td>
  142 + <div style="float: right;">类型</div>
  143 + </td>
  144 + <td colspan="3">
  145 + <div style="float: left;">
  146 + <select class="form-control" name="sxtj">
  147 + <option value="0">全部</option>
  148 + <option value="1">一车一单</option>
  149 + <option value="2">一车多单</option>
  150 + <option value="3">有加油没里程</option>
  151 + <option value="4">有里程没加油</option>
  152 + </select>
  153 + </div>
  154 +
  155 + </td>
  156 + </tr>
  157 + <tr>
  158 + <td colspan="17">
  159 + <div style="float: left;">
  160 + 总计 &nbsp;&nbsp; 加注量:&nbsp;<label id="sumJzl"></label>
  161 + &nbsp;&nbsp; 耗油量:&nbsp;<label id="sumYh"></label> &nbsp;&nbsp;
  162 + 损耗量:&nbsp;<label id="sumSh"></label>
  163 + </div>
  164 + </td>
  165 + </tr>
  166 +
  167 + </thead>
  168 +
  169 + </table>
62 170 </div>
63 171 </div>
64   - <div>
65   - <table
66   - class="table table-striped table-bordered table-hover table-checkable"
67   - id="datatable_ylb" style="table-layout: fixed;margin-bottom: 0px">
68   - <thead>
69   - <tr role="row" class="filter">
70   - <td colspan="2">
71   - <div style="float: right;">&nbsp;公司&nbsp;</div>
72   - </td>
73   - <td colspan="3">
74   - <div style="float: left; width: 150px">
75   - <select class="form-control" name="ssgsdm_like"
76   - id="ylbListGsdmId"></select>
77   - </div>
78   - </td>
79   - <td colspan="2">
80   - <div style="float: right;">&nbsp;分公司&nbsp;</div>
81   - </td>
82   - <td colspan="4">
83   - <div style="float: left;">
84   - <select class="form-control" name="fgsdm_like"
85   - id="ylbListFgsdmId" style="width: 150px"></select>
86   - </div>
87   - </td>
88   - <td>
89   - <div style="float: right;">日期</div>
90   - </td>
91   - <td colspan="3">
92   - <div style="float: left;">
93   - <input type="text" style="width: 120px" name="rq" id="rq" />
94   - </div>
95   - </td>
96   - <td rowspan="2" colspan="2">
97   - <div style="float: left;">
98   - &nbsp;
99   - <button
100   - class="btn btn-sm green btn-outline filter-submit margin-bottom"
101   - style="margin-right: 0px">
102   - <i class="fa fa-search"></i> 搜索
103   - </button>
104   - <!-- <button class="btn btn-sm red btn-outline filter-cancel" style="margin-right:0px"> -->
105   - <!-- <i class="fa fa-times"></i> 重置 -->
106   - <!-- </button> -->
107   -
108   - </div>
109   - </td>
110   - </tr>
111   - <tr class="filter2">
112   - <td colspan="2">
113   - <div style="float: right;">&nbsp;线路</div>
114   - </td>
115   - <td colspan="3">
116   - <div style="float: left;">
117   - <select class="form-control" name="xlbm_like" id="xlbm"
118   - style="width: 150px;"></select>
119   - </div>
120   - </td>
121   - <td colspan="2">
122   - <div style="float: right;">&nbsp;内部编码</div>
123   - </td>
124   - <td colspan="4">
125   - <div style="float: left;">
126   - <select class="form-control" name="nbbm_eq" id="nbbm"
127   - style="width: 120px;"></select>
128   - </div>
129   - <div style="float: left;">
130   - <button class="btn btn-sm #000 btn-outline filter-cancel"
131   - style="margin-right: 0px">
132   - <i class="fa fa-times"></i>
133   - </button>
134   - </div>
135   - </td>
136   - <td>
137   - <div style="float: right;">类型</div>
138   - </td>
139   - <td colspan="3">
140   - <div style="float: left;">
141   - <select class="form-control" name="sxtj">
142   - <option value="0">全部</option>
143   - <option value="1">一车一单</option>
144   - <option value="2">一车多单</option>
145   - <option value="3">有加油没里程</option>
146   - <option value="4">有里程没加油</option>
147   - </select>
148   - </div>
149   -
150   - </td>
151   - </tr>
152   - <tr>
153   - <td colspan="17">
154   - <div style="float: left;">
155   - 总计 &nbsp;&nbsp; 加注量:&nbsp;<label id="sumJzl"></label>
156   - &nbsp;&nbsp; 耗油量:&nbsp;<label id="sumYh"></label> &nbsp;&nbsp;
157   - 损耗量:&nbsp;<label id="sumSh"></label>
158   - </div>
159   - </td>
160   - </tr>
161   -
162   - </thead>
163   -
164   - </table>
165   - </div>
166   - </div>
167   -
168   - <div id="ylbtable" class="portlet-body table-container " style="height: calc(100% + 100px);overflow: hidden;position: absolute;background: #fff;">
169   -
170   - <table
171   - class="table table-striped table-bordered table-hover table-checkable"
172   - style="table-layout: fixed;margin-bottom: 0px;">
173   - <thead>
174   - <tr role="row" class="heading">
175   - <td width="40px">
176   - <input type="checkbox" id="selectAll" class="group-checkable" >
177   - </td>
178   - <td width="40px">序号</td>
179   - <td width="8%">日期</td>
180   - <td width="5%">公司</td>
181   - <td width="8%">线路</td>
182   - <td width="5%">自编号</td>
183   - <td width="7%">驾驶员</td>
184   - <td width="4%">加油量</td>
185   - <td width="5%">出场存油</td>
186   - <td width="5%">进场存油</td>
187   - <td width="5%">油耗</td>
188   - <td width="8%">燃油类型</td>
189   - <td width="4%">尿素</td>
190   - <td width="8%">耗损原因</td>
191   - <td width="5%">耗损油量</td>
192   - <td width="5%">当日总里程</td>
193   - <td width="5%">数据类型</td>
194   - <td >百公里油耗</td>
195   - </tr>
196   - </thead>
197   - </table>
198   - <div id="datatable_ylb_body_div" style="display: block;position:absolute;overflow: auto;height: calc(100% - 80px);">
  172 +
  173 + <div id="ylbtable" class="portlet-body table-container " style="height: calc(100% + 100px);overflow: hidden;position: absolute;background: #fff;">
  174 +
199 175 <table
200   - class="table table-striped table-bordered table-hover table-checkable"
201   - id="datatable_ylb_body"
202   - style="table-layout: fixed; overflow: auto; ">
203   - <tbody></tbody>
204   - </table>
205   - <div style="text-align: right;margin-right: 50px">
206   - <a class="btn btn-circle " href="add.html" data-pjax><i
207   - class="fa fa-plus"></i> 添加</a>
208   - <button type="button" class="btn btn-circle removeButton" >
209   - <i class="fa fa-trash-o"></i> 删除
210   - </button>
211   - <button type="button" class="btn btn-circle sortButton">
212   - <i class="fa fa-minus-square"></i> 拆分
213   - </button>
214   - <button type="button" class="btn btn-circle saveButton" >
215   - <i class="fa fa-check-circle"></i> 保存
216   - </button>
217   - </div>
218   - </div>
219   -
220   -
221   - <div style="text-align: right;">
222   - <ul id="pagination" class="pagination"></ul>
  176 + class="table table-striped table-bordered table-hover table-checkable"
  177 + style="table-layout: fixed;margin-bottom: 0px;">
  178 + <thead>
  179 + <tr role="row" class="heading">
  180 + <td width="40px">
  181 + <input type="checkbox" id="selectAll" class="group-checkable" >
  182 + </td>
  183 + <td width="40px">序号</td>
  184 + <td width="8%">日期</td>
  185 + <td width="5%">公司</td>
  186 + <td width="8%">线路</td>
  187 + <td width="5%">自编号</td>
  188 + <td width="7%">驾驶员</td>
  189 + <td width="4%">加油量</td>
  190 + <td width="5%">出场存油</td>
  191 + <td width="5%">进场存油</td>
  192 + <td width="5%">油耗</td>
  193 + <td width="8%">燃油类型</td>
  194 + <td width="4%">尿素</td>
  195 + <td width="8%">耗损原因</td>
  196 + <td width="5%">耗损油量</td>
  197 + <td width="5%">当日总里程</td>
  198 + <td width="5%">数据类型</td>
  199 + <td >百公里油耗</td>
  200 + </tr>
  201 + </thead>
  202 + </table>
  203 + <div id="datatable_ylb_body_div" style="display: block;position:absolute;overflow: auto;height: calc(100% - 80px);">
  204 + <table
  205 + class="table table-striped table-bordered table-hover table-checkable"
  206 + id="datatable_ylb_body"
  207 + style="table-layout: fixed; overflow: auto; ">
  208 + <tbody></tbody>
  209 + </table>
  210 + <div style="text-align: right;margin-right: 50px">
  211 + <a class="btn btn-circle " href="add.html" data-pjax><i
  212 + class="fa fa-plus"></i> 添加</a>
  213 + <button type="button" class="btn btn-circle removeButton" >
  214 + <i class="fa fa-trash-o"></i> 删除
  215 + </button>
  216 + <button type="button" class="btn btn-circle sortButton">
  217 + <i class="fa fa-minus-square"></i> 拆分
  218 + </button>
  219 + <button type="button" class="btn btn-circle saveButton" >
  220 + <i class="fa fa-check-circle"></i> 保存
  221 + </button>
  222 + </div>
  223 + </div>
  224 +
  225 +
  226 + <div style="text-align: right;">
  227 + <ul id="pagination" class="pagination"></ul>
  228 + </div>
223 229 </div>
224 230 </div>
225   -</div>
226 231 <script id="ylb_list_temp" type="text/html">
227 232 {{each list as obj i}}
228 233 <tr>
... ... @@ -244,10 +249,15 @@
244 249  
245 250 </td>
246 251 <td width="7%">
247   - {{obj.jsy}}/{{obj.name}}
  252 + {{if obj.jsy=='' || obj.jsy==null }}
  253 + <input data-id="{{obj.id}}" style=" width:100%" type="text" class="in_carpark_jsy" ></input>
  254 + <button class="btn btn-sm blue btn-jsyUpdate" style=" width:100%" data-id="{{obj.id}}">填写工号</button>
  255 + {{else}}
  256 + {{obj.jsy}}/{{obj.name}}
  257 + {{/if}}
  258 +
248 259 </td>
249 260 <td width="4%">
250   -
251 261 <lable data-id="{{obj.id}}" class="in_carpark_jzl"> {{obj.jzl}}</lable>
252 262 </td>
253 263 <td width="5%">
... ... @@ -699,6 +709,7 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
699 709 var bodyHtm = template('ylb_list_temp', {list:data});
700 710  
701 711 $('#datatable_ylb_body tbody').html(bodyHtm);
  712 + $('.btn-jsyUpdate').on('click', jsyUpdate);
702 713 $('.yl_sxzy').on('mouseup', yhSxzy);
703 714 layer.close(l);
704 715 $get('/ylb/sumYlb',params,function(returns){
... ... @@ -738,6 +749,18 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
738 749 });
739 750 }
740 751  
  752 +
  753 + function jsyUpdate(){
  754 + var id = $(this).data('id');
  755 + var jsy=$('.in_carpark_jsy[data-id='+id+']', '#ll_oil_list').val();
  756 + $get('/ylb/updateJsy',{id:id,jsy:jsy}, function(result){
  757 + layer.msg('修改成功.');
  758 + var params = getParamsList();
  759 + page = 0;
  760 + jsDoQuery(params, true);
  761 + });
  762 +
  763 + }
741 764 //页面计算防止精度丢失
742 765 var accAdd = function (a, b) {
743 766 var c, d, e;
... ... @@ -963,6 +986,17 @@ onkeyup=&quot;this.value=this.value.replace(/[^(\d||/.)]/g,&#39;&#39;).replace(&#39;.&#39;,&#39;$#$&#39;).rep
963 986  
964 987 }
965 988 // }
  989 +
  990 + $("#cxtj").on("click", function () {
  991 + if ($("#rq").val() != "") {
  992 +// var params=getParamsList();
  993 + $post('/ylb/updateHistory', {date:'2017-11-07',line:'10708',gsdm:'26',fgsdm:'1'}, function (result) {
  994 + window.open("/downloadFile/download?fileName="+$("#rq").val()+"进出场存油量" );
  995 + });
  996 + } else {
  997 + layer.msg('请选择日期.');
  998 + }
  999 + });
966 1000  
967 1001 //导出
968 1002  
... ...
src/main/resources/static/pages/permission/module/list.html
... ... @@ -192,4 +192,31 @@ function getTreeData(cb){
192 192 });
193 193 }
194 194  
  195 +/**
  196 + * 将模块List 转换为树结构
  197 + * @param arr
  198 + * @returns {Array}
  199 + */
  200 +function createTreeData(arr){
  201 + var treeData = [];
  202 + var len = arr.length;
  203 + for(var i = 0; i < len; i ++){
  204 + var pId = arr[i].pId;
  205 + arr[i].text = arr[i].name;
  206 + if(!pId){
  207 + treeData.push(arr[i]);
  208 + }
  209 +
  210 + for(var j = 0; j < len; j ++){
  211 + if(pId == arr[j].id){
  212 + if(!arr[j].children)
  213 + arr[j].children = [];
  214 + arr[j].children.push(arr[i]);
  215 + break;
  216 + }
  217 + }
  218 + }
  219 + return treeData;
  220 +}
  221 +
195 222 </script>
196 223 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/add.html
... ... @@ -169,5 +169,33 @@ $(function(){
169 169 cb && cb(treeData)
170 170 });
171 171 }
  172 +
  173 + /**
  174 + * 将模块List 转换为树结构
  175 + * @param arr
  176 + * @returns {Array}
  177 + */
  178 + function createTreeData(arr){
  179 + var treeData = [];
  180 + var len = arr.length;
  181 + for(var i = 0; i < len; i ++){
  182 + var pId = arr[i].pId;
  183 + arr[i].text = arr[i].name;
  184 + if(!pId){
  185 + treeData.push(arr[i]);
  186 + }
  187 +
  188 + for(var j = 0; j < len; j ++){
  189 + if(pId == arr[j].id){
  190 + if(!arr[j].children)
  191 + arr[j].children = [];
  192 + arr[j].children.push(arr[i]);
  193 + break;
  194 + }
  195 + }
  196 + }
  197 + return treeData;
  198 + }
  199 +
172 200 });
173 201 </script>
174 202 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/edit.html
... ... @@ -187,5 +187,33 @@ $(function(){
187 187 cb && cb(treeData)
188 188 });
189 189 }
  190 +
  191 + /**
  192 + * 将模块List 转换为树结构
  193 + * @param arr
  194 + * @returns {Array}
  195 + */
  196 + function createTreeData(arr){
  197 + var treeData = [];
  198 + var len = arr.length;
  199 + for(var i = 0; i < len; i ++){
  200 + var pId = arr[i].pId;
  201 + arr[i].text = arr[i].name;
  202 + if(!pId){
  203 + treeData.push(arr[i]);
  204 + }
  205 +
  206 + for(var j = 0; j < len; j ++){
  207 + if(pId == arr[j].id){
  208 + if(!arr[j].children)
  209 + arr[j].children = [];
  210 + arr[j].children.push(arr[i]);
  211 + break;
  212 + }
  213 + }
  214 + }
  215 + return treeData;
  216 + }
  217 +
190 218 });
191 219 </script>
192 220 \ No newline at end of file
... ...
src/main/resources/static/pages/permission/resource/list.html
... ... @@ -281,6 +281,33 @@ $(function(){
281 281 });
282 282 }
283 283  
  284 + /**
  285 + * 将模块List 转换为树结构
  286 + * @param arr
  287 + * @returns {Array}
  288 + */
  289 + function createTreeData(arr){
  290 + var treeData = [];
  291 + var len = arr.length;
  292 + for(var i = 0; i < len; i ++){
  293 + var pId = arr[i].pId;
  294 + arr[i].text = arr[i].name;
  295 + if(!pId){
  296 + treeData.push(arr[i]);
  297 + }
  298 +
  299 + for(var j = 0; j < len; j ++){
  300 + if(pId == arr[j].id){
  301 + if(!arr[j].children)
  302 + arr[j].children = [];
  303 + arr[j].children.push(arr[i]);
  304 + break;
  305 + }
  306 + }
  307 + }
  308 + return treeData;
  309 + }
  310 +
284 311 //删除
285 312 $('#removeButton').on('click', function(){
286 313 if($(this).attr('disabled'))
... ...
src/main/resources/static/pages/permission/role/settings.html
... ... @@ -215,5 +215,33 @@ $(function(){
215 215 cb && cb(treeData)
216 216 });
217 217 }
  218 +
  219 + /**
  220 + * 将模块List 转换为树结构
  221 + * @param arr
  222 + * @returns {Array}
  223 + */
  224 + function createTreeData(arr){
  225 + var treeData = [];
  226 + var len = arr.length;
  227 + for(var i = 0; i < len; i ++){
  228 + var pId = arr[i].pId;
  229 + arr[i].text = arr[i].name;
  230 + if(!pId){
  231 + treeData.push(arr[i]);
  232 + }
  233 +
  234 + for(var j = 0; j < len; j ++){
  235 + if(pId == arr[j].id){
  236 + if(!arr[j].children)
  237 + arr[j].children = [];
  238 + arr[j].children.push(arr[i]);
  239 + break;
  240 + }
  241 + }
  242 + }
  243 + return treeData;
  244 + }
  245 +
218 246 });
219 247 </script>
... ...
src/main/resources/static/pages/report/countMileage/countBus/company/countBusMileage.html
... ... @@ -155,7 +155,7 @@
155 155 var tempData = {};
156 156 $.get('/report/lineList',function(xlList){
157 157 var data = [];
158   - data.push({id: " ", text: "全部线路"});
  158 +// data.push({id: " ", text: "全部线路"});
159 159 $.get('/user/companyData', function(result){
160 160 for(var i = 0; i < result.length; i++){
161 161 var companyCode = result[i].companyCode;
... ...
src/main/resources/static/pages/report/countMileage/countBus/countBusMileage.html
... ... @@ -155,7 +155,7 @@
155 155 var tempData = {};
156 156 $.get('/report/lineList',function(xlList){
157 157 var data = [];
158   - data.push({id: " ", text: "全部线路"});
  158 +// data.push({id: " ", text: "全部线路"});
159 159 $.get('/user/companyData', function(result){
160 160 for(var i = 0; i < result.length; i++){
161 161 var companyCode = result[i].companyCode;
... ...
src/main/resources/static/pages/report/countMileage/countLine/countLineMileage.html
... ... @@ -263,7 +263,7 @@
263 263 params['xlName'] = xlName;
264 264 params['type'] = "query";
265 265 var i = layer.load(2);
266   - $get('/report/countLineMileage',params,function(result){
  266 + $get('/report/countLineMileage2',params,function(result){
267 267 $("#datetodate").html(date+"至"+date2);
268 268 layer.close(i);
269 269 // 把数据填充到模版中
... ... @@ -290,7 +290,7 @@
290 290 params['xlName'] = xlName;
291 291 params['type'] = "export";
292 292 params['by']='sj';
293   - $get('/report/countLineMileage',params,function(result){
  293 + $get('/report/countLineMileage2',params,function(result){
294 294 window.open("/downloadFile/download?fileName=线路公里统计表");
295 295 });
296 296 });
... ...
src/main/resources/static/pages/report/oil/oilListMonth.html
... ... @@ -69,15 +69,6 @@
69 69 <td>日期</td>
70 70 <td>存油</td>
71 71  
72   - <td>序号</td>
73   - <td>车号</td>
74   - <td>日期</td>
75   - <td>存油</td>
76   -
77   - <td>序号</td>
78   - <td>车号</td>
79   - <td>日期</td>
80   - <td>存油</td>
81 72 </tr>
82 73 </thead>
83 74  
... ... @@ -139,10 +130,8 @@
139 130 var xlList;
140 131 $.get('/report/lineList',function(result){
141 132 xlList=result;
142   -
143 133 $.get('/user/companyData', function(result){
144 134 obj = result;
145   - console.log(obj);
146 135 var options = '';
147 136 for(var i = 0; i < obj.length; i++){
148 137 options += '<option value="'+obj[i].companyCode+'">'+obj[i].companyName+'</option>';
... ... @@ -226,9 +215,6 @@
226 215 var gsdm = $("#gsdm").val();
227 216 var fgsdm = $("#fgsdm").val();
228 217 $get('/ylb/oilListMonth',{line:line,date:date,gsdm:gsdm,fgsdm,fgsdm,type:'query'},function(result){
229   -// $.each(result, function(i, obj) {
230   -// obj.rq = moment(obj.rq).format("DD");
231   -// });
232 218 var oilListMonth = template('oilListMonth',{list:result});
233 219 $('#forms tbody').html(oilListMonth);
234 220 });
... ... @@ -252,16 +238,29 @@
252 238 </script>
253 239 <script type="text/html" id="oilListMonth">
254 240 {{each list as obj i}}
255   - {{if i%5 == 0}}
  241 +
256 242 <tr>
257   - {{/if}}
258   - <td>{{i+1}}</td>
259   - <td>{{obj.nbbm}}</td>
260   - <td>{{obj.rq}}</td>
261   - <td>{{obj.jzyl}}</td>
262   - {{if (i+1)%5 == 0}}
  243 + {{if obj.xh0==99}}
  244 + <td colspan="12">
  245 + {{obj.nbbm0}}
  246 + </td>
  247 + {{else}}
  248 + <td>{{obj.xh0}}</td>
  249 + <td>{{obj.nbbm0}}</td>
  250 + <td>{{obj.rq0}}</td>
  251 + <td>{{obj.jzyl0}}</td>
  252 + <td>{{obj.xh1}}</td>
  253 + <td>{{obj.nbbm1}}</td>
  254 + <td>{{obj.rq1}}</td>
  255 + <td>{{obj.jzyl1}}</td>
  256 + <td>{{obj.xh2}}</td>
  257 + <td>{{obj.nbbm2}}</td>
  258 + <td>{{obj.rq2}}</td>
  259 + <td>{{obj.jzyl2}}</td>
  260 + {{/if}}
  261 +
263 262 </tr>
264   - {{/if}}
  263 +
265 264 {{/each}}
266 265 {{if list.length == 0}}
267 266 <tr>
... ...
src/main/resources/static/pages/report/timetable/timetable.html
... ... @@ -298,6 +298,33 @@
298 298 });
299 299 }
300 300  
  301 + /**
  302 + * 将模块List 转换为树结构
  303 + * @param arr
  304 + * @returns {Array}
  305 + */
  306 + function createTreeData(arr){
  307 + var treeData = [];
  308 + var len = arr.length;
  309 + for(var i = 0; i < len; i ++){
  310 + var pId = arr[i].pId;
  311 + arr[i].text = arr[i].name;
  312 + if(!pId){
  313 + treeData.push(arr[i]);
  314 + }
  315 +
  316 + for(var j = 0; j < len; j ++){
  317 + if(pId == arr[j].id){
  318 + if(!arr[j].children)
  319 + arr[j].children = [];
  320 + arr[j].children.push(arr[i]);
  321 + break;
  322 + }
  323 + }
  324 + }
  325 + return treeData;
  326 + }
  327 +
301 328 $("#line").on("change", function(){
302 329 line = $("#line").val();
303 330 updateTtinfo();
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/edit.html
... ... @@ -234,7 +234,15 @@
234 234 placeholder="请输入标准油耗/关空调"/>
235 235 </div>
236 236 </div>
  237 +
237 238 <div class="form-group">
  239 + <label class="col-md-2 control-label">是否报废:</label>
  240 + <div class="col-md-3">
  241 + <sa-Radiogroup model="ctrl.busInfoForSave.scrapState" dicgroup="truefalseType" name="scrapState"></sa-Radiogroup>
  242 + </div>
  243 + </div>
  244 +
  245 + <div class="form-group" ng-if="ctrl.busInfoForSave.scrapState == 1">
238 246 <label class="col-md-2 control-label">报废号:</label>
239 247 <div class="col-md-4">
240 248 <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode"
... ... @@ -242,7 +250,7 @@
242 250 </div>
243 251 </div>
244 252  
245   - <div class="form-group">
  253 + <div class="form-group" ng-if="ctrl.busInfoForSave.scrapState == 1">
246 254 <label class="col-md-2 control-label">报废日期:</label>
247 255 <div class="col-md-4">
248 256 <div class="input-group">
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/form.html
... ... @@ -235,31 +235,31 @@
235 235 placeholder="请输入标准油耗/关空调"/>
236 236 </div>
237 237 </div>
238   - <div class="form-group">
239   - <label class="col-md-2 control-label">报废号:</label>
240   - <div class="col-md-4">
241   - <input type="text" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode"
242   - placeholder="请输入报废号"/>
243   - </div>
244   - </div>
245   -
246   - <div class="form-group">
247   - <label class="col-md-2 control-label">报废日期:</label>
248   - <div class="col-md-4">
249   - <div class="input-group">
250   - <input type="text" class="form-control"
251   - name="scrapDate" placeholder="请选择报废日期..."
252   - uib-datepicker-popup="yyyy年MM月dd日"
253   - is-open="ctrl.scrapDateOpen"
254   - ng-model="ctrl.busInfoForSave.scrapDate" readonly/>
255   - <span class="input-group-btn">
256   - <button type="button" class="btn btn-default" ng-click="ctrl.scrapDate_open()">
257   - <i class="glyphicon glyphicon-calendar"></i>
258   - </button>
259   - </span>
260   - </div>
261   - </div>
262   - </div>
  238 + <!--<div class="form-group">-->
  239 + <!--<label class="col-md-2 control-label">报废号:</label>-->
  240 + <!--<div class="col-md-4">-->
  241 + <!--<input type="text" class="form-control" ng-model="ctrl.busInfoForSave.scrapCode"-->
  242 + <!--placeholder="请输入报废号"/>-->
  243 + <!--</div>-->
  244 + <!--</div>-->
  245 +
  246 + <!--<div class="form-group">-->
  247 + <!--<label class="col-md-2 control-label">报废日期:</label>-->
  248 + <!--<div class="col-md-4">-->
  249 + <!--<div class="input-group">-->
  250 + <!--<input type="text" class="form-control"-->
  251 + <!--name="scrapDate" placeholder="请选择报废日期..."-->
  252 + <!--uib-datepicker-popup="yyyy年MM月dd日"-->
  253 + <!--is-open="ctrl.scrapDateOpen"-->
  254 + <!--ng-model="ctrl.busInfoForSave.scrapDate" readonly/>-->
  255 + <!--<span class="input-group-btn">-->
  256 + <!--<button type="button" class="btn btn-default" ng-click="ctrl.scrapDate_open()">-->
  257 + <!--<i class="glyphicon glyphicon-calendar"></i>-->
  258 + <!--</button>-->
  259 + <!--</span>-->
  260 + <!--</div>-->
  261 + <!--</div>-->
  262 + <!--</div>-->
263 263 <div class="form-group">
264 264 <label class="col-md-2 control-label">厂牌型号1:</label>
265 265 <div class="col-md-4">
... ...
src/main/resources/static/pages/scheduleApp/module/basicInfo/busInfoManage/list.html
... ... @@ -12,6 +12,7 @@
12 12 <th style="width: 150px;">所在公司</th>
13 13 <th style="width: 160px;">所在分公司</th>
14 14 <th style="width: 60px">电车</th>
  15 + <th style="width: 80px;" >状态</th>
15 16 <th style="width: 100%">操作</th>
16 17 </tr>
17 18 <tr role="row" class="filter">
... ... @@ -62,6 +63,11 @@
62 63  
63 64 </td>
64 65 <td>
  66 + <label class="checkbox-inline input">
  67 + <input type="checkbox" ng-model="ctrl.searchCondition()['scrapState_eq']" />报废
  68 + </label>
  69 + </td>
  70 + <td>
65 71 <button class="btn btn-sm green btn-outline filter-submit margin-bottom"
66 72 ng-click="ctrl.doPage()">
67 73 <i class="fa fa-search"></i> 搜索</button>
... ... @@ -110,6 +116,9 @@
110 116 <span ng-bind="info.sfdc | dict:'truefalseType':'未知' "></span>
111 117 </td>
112 118 <td>
  119 + <span ng-bind="info.scrapState | dict:'truefalseType':'未知' "></span>
  120 + </td>
  121 + <td>
113 122 <!--<a href="details.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 详细 </a>-->
114 123 <!--<a href="edit.html?lineId={{obj.id}}" class="btn default blue-stripe btn-sm"> 修改 </a>-->
115 124 <a ui-sref="busInfoManage_detail({id: info.id})" class="btn btn-info btn-sm"> 详细 </a>
... ...
src/main/resources/static/pages/trafficManage/js/lineStationUpload.js
... ... @@ -111,6 +111,8 @@
111 111 success:function(data) {
112 112 if(data == 'success'){
113 113 alert("上传成功");
  114 + }else if(data == '0'){
  115 + alert("上传失败,线路编号有0");
114 116 }else{
115 117 alert("上传失败");
116 118 }
... ...
src/main/resources/static/pages/trafficManage/js/lineStationUploadRecord.js
... ... @@ -31,7 +31,7 @@
31 31  
32 32 initLineSelect2();
33 33  
34   - function initLineSelect2(compD) {debugger;
  34 + function initLineSelect2(compD) {
35 35 getComp(function(rs) {
36 36 var params = {};
37 37 if(rs.length>0) {
... ... @@ -55,7 +55,7 @@
55 55 if(len_>0) {
56 56 $.each(array, function(i, g){
57 57 if(g.name!='' || g.name != null) {
58   - paramsD.push({'id':g.name + '_' + g.id + '_' + g.lineCode ,'text':g.name});
  58 + paramsD.push({'id':g.id ,'text':g.name});
59 59 }
60 60 });
61 61 initPinYinSelect2($('#line'),paramsD,function(selector) {
... ...
src/main/resources/static/pages/trafficManage/js/timeTempletUpload.js
... ... @@ -97,6 +97,7 @@
97 97 $.each(inputs, function(i, element) {
98 98 params[$(element).attr("name")] = $(element).val();
99 99 });
  100 + params["isCancel_ne"] = true;// 过滤作废时刻表
100 101 var i = layer.load(2);
101 102 $get('/tic_ec', params, function(data) {
102 103 var content = data.data.content;
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch/h_add_temp_sch.html
... ... @@ -30,7 +30,7 @@
30 30 <div class="uk-form-row">
31 31 <label class="uk-form-label">班次类型</label>
32 32 <div class="uk-form-controls">
33   - <select class="form-control nt-dictionary" name="bcType" data-code="{{bcType}}"
  33 + <select class="form-control nt-dictionary" required name="bcType" data-code="{{bcType}}"
34 34 data-group=ScheduleType></select>
35 35 </div>
36 36 </div>
... ...
src/main/resources/static/real_control_v2/fragments/north/nav/history_sch_maintain.html
... ... @@ -37,6 +37,8 @@
37 37 </div>
38 38 <button class="uk-button">检索</button>
39 39 <a class="add_lp_link" ><i class="uk-icon-plus"></i> 临加路牌</a>
  40 + <button id="reCountBtn" class="uk-button uk-button-danger uk-button-mini" style="position: absolute;right: 12px;bottom: 14px;">
  41 + 重新统计</button>
40 42 </fieldset>
41 43 </form>
42 44 </div>
... ... @@ -414,6 +416,39 @@
414 416  
415 417 return true;
416 418 }
  419 +
  420 + /**
  421 + * 重新统计
  422 + */
  423 + $('#reCountBtn', modal).on('click', function () {
  424 + var rq = $('.h-s-time li.uk-active', modal).text(),
  425 + lineName = $('.h-s-line li.uk-active', modal).text(),
  426 + lineCode = $('.h-s-line li.uk-active', modal).data('id');
  427 +
  428 + var that = this;
  429 + alt_confirm('确定要重新统计 ' + lineName + '('+rq+')的数据吗?',function () {
  430 + $(that).attr('disabled', 'disabled');
  431 + $(that).prepend('<i class="uk-icon-spinner uk-icon-spin"></i>');
  432 +
  433 +
  434 + var reCountEp = EventProxy.create('ylbUpdate', function () {
  435 + $('i.uk-icon-spin', that).remove();
  436 + $(that).removeAttr('disabled');
  437 + notify_succ('重新统计成功!');
  438 + });
  439 +
  440 + //统计路单 -娄高峰
  441 + /*gb_common.$get('/calcWaybill/generateNew', {date:rq, line: lineCode}, function () {
  442 + reCountEp.emitLater('calcWaybill');
  443 + });*/
  444 +
  445 + //统计油 -廖磊
  446 + gb_common.$post('/ylb/updateHistory', {date:rq, line: lineCode}, function () {
  447 + reCountEp.emitLater('ylbUpdate');
  448 + });
  449 +
  450 + }, '我确定');
  451 + });
417 452 })();
418 453 </script>
419 454 </div>
420 455 \ No newline at end of file
... ...
src/main/resources/static/real_control_v2/js/forms/wrap.html
... ... @@ -100,9 +100,13 @@
100 100 //ed=d.format(f),
101 101 //sd=d.subtract(3, 'days').format(f);
102 102  
103   - $('#date', '.form-page-content').data('DateTimePicker')
104   - .defaultDate(d.format(f));
105   - //.maxDate(ed).minDate(sd);
  103 + try{
  104 + $('#date', '.form-page-content').data('DateTimePicker')
  105 + .defaultDate(d.format(f));
  106 + //.maxDate(ed).minDate(sd);
  107 + }catch (e){
  108 + console.log(e);
  109 + }
106 110  
107 111 if($("#ddrbBody").length > 0){
108 112 $("#ddrbBody").height("620px");
... ...
src/main/resources/static/real_control_v2/js/line_schedule/context_menu.js
... ... @@ -321,27 +321,7 @@ var gb_schedule_context_menu = (function () {
321 321 },
322 322 'lj_zrw': {
323 323 name: '临加/子任务'
324   - }/*,
325   - 'shortcut': {
326   - name: '...',
327   - items: {
328   - 'add_temp_sch':{
329   - name: '新增临加班次'
330   - },
331   - 'add_oil': {
332   - name: '(子任务)空驶进出场'
333   - },
334   - 'add_sub_task_in': {
335   - name: '(子任务)进场'
336   - },
337   - 'add_sub_task_out': {
338   - name: '(子任务)出场'
339   - },
340   - 'add_sub_task_range_turn': {
341   - name: '(子任务)区间调头'
342   - }
343   - }
344   - }*/,
  324 + },
345 325 'sep3': '---------',
346 326 'add_temp_sch': {
347 327 name: '添加临加班次'
... ...