Commit 80418565110a8bf50eb6d4ea57efce963102f58d

Authored by 李强
1 parent dbe5d3c8

李强update

src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
1 1 package com.bsth.service.impl;
2 2  
3 3 import java.io.ByteArrayInputStream;
  4 +import java.io.File;
4 5 import java.io.InputStream;
5 6 import java.util.ArrayList;
6 7 import java.util.HashMap;
7 8 import java.util.List;
8 9 import java.util.Map;
  10 +import java.util.Properties;
9 11  
10 12 import org.springframework.beans.factory.annotation.Autowired;
11 13 import org.springframework.stereotype.Service;
... ... @@ -20,6 +22,8 @@ import com.bsth.repository.StationRepository;
20 22 import com.bsth.repository.StationRouteRepository;
21 23 import com.bsth.service.StationRouteService;
22 24 import com.bsth.util.FTPClientUtils;
  25 +import com.bsth.util.Test;
  26 +import com.bsth.util.db.DBUtils_MS;
23 27  
24 28 /**
25 29 *
... ... @@ -512,93 +516,57 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ
512 516 // 获取线路ID
513 517 Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString());
514 518  
  519 + /** 查询线路信息 */
515 520 Line line = lineRepository.findOne(lineId);
516 521  
517   - List<Object[]> objects = repository.usingSingle(lineId);
  522 + /** 获取配置文件里的ftp参数 */
  523 + Map<String, Object> FTPParamMap = readPropertiesGetFTPParam();
518 524  
519   - String stationRStr = "";
  525 + // 压缩文件名
  526 + String odlGzFileName = line.getLineCode() + ".tar.gz";
520 527  
521   - // windows下的文本文件换行符
522   - // String enterStr = "\r\n";
  528 + // text文件名
  529 + String textFileName = line.getLineCode() + ".txt";
523 530  
524   - // linux/unix下的文本文件换行符
525   - String enterStr = "\r";
  531 + FTPClientUtils clientUtils = new FTPClientUtils();
526 532  
527   - if(objects.size()>0) {
528   -
529   - for(int i = 0; i<objects.size();i++) {
530   -
531   - // 经度
532   - String lng = objects.get(i)[0].toString();
533   -
534   - // 纬度
535   - String lat = " " + objects.get(i)[1].toString();
536   -
537   - // 站点类型
538   - String stationMake = objects.get(i)[3].toString();
539   -
540   - if(stationMake.equals("E")) {
541   -
542   - stationMake = " " + "2";
543   -
544   - }else {
545   -
546   - stationMake =" " + "1";
547   -
548   - }
549   -
550   - // 站点序号
551   - String stationNo = " " + objects.get(i)[4].toString();
552   -
553   - // 站点编码
554   - String stationCode = " " + objects.get(i)[5].toString();
555   -
556   - double tempd = Double.parseDouble(objects.get(i)[6].toString())*1000;
557   -
558   - // 站点距离
559   - String staitondistance = " " + String.valueOf((int) tempd);
560   -
561   - // 限速
562   - String sleepStr = " " + "60";
563   -
564   - // 站点名称
565   - String staitonName = " " + objects.get(i)[7].toString();
566   -
567   - stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + staitonName + enterStr;
568   -
569   - }
570   -
571   - }
  533 + String url = FTPParamMap.get("url").toString();
  534 +
  535 + int port = Integer.valueOf(FTPParamMap.get("port").toString());
572 536  
573   - System.out.println(stationRStr);
  537 + String username = FTPParamMap.get("username").toString();
574 538  
575   - FTPClientUtils ftpClientUtils = new FTPClientUtils();
  539 + String password = FTPParamMap.get("password").toString();
576 540  
577   - // ip
578   - String url = "222.66.0.205";
  541 + String remotePath = FTPParamMap.get("remotePath").toString();
579 542  
580   - // ftp端口
581   - int port = 21;
  543 + /** 如果行单文件已存在则删除 */
  544 + clientUtils.deleteFtpFile(url, port, username, password, remotePath, odlGzFileName);
582 545  
583   - // 用户名
584   - String username = "transport";
  546 + clientUtils.deleteFtpFile(url, port, username, password, remotePath, textFileName);
585 547  
586   - // 密码
587   - String password = "transport123";
  548 + List<Object[]> objects = repository.usingSingle(lineId);
  549 +
  550 + String textStr = newTextFileToFTP(objects);
  551 +
  552 + textStr = line.getName() + " " + "2" + "\r\n" + textStr;
588 553  
589   - // 路径
590   - String path = "down/";
  554 + InputStream input = new ByteArrayInputStream(textStr.getBytes("utf-8"));
591 555  
592   - // 文件名
593   - String filename = line.getLineCode() + ".txt";
  556 + /** 生成text文件 */
  557 + clientUtils.uploadFile(url, port, username, password, remotePath, textFileName, input);
594 558  
595   - String versions = "2";
  559 + Test test= new Test();
596 560  
597   - stationRStr = line.getName() + " " +versions + enterStr + stationRStr;
  561 + File textFile = clientUtils.GetFtpFile(url, port, username, password, remotePath, textFileName);
598 562  
599   - InputStream input = new ByteArrayInputStream(stationRStr.getBytes("utf-8"));
  563 + File[] sources = new File[] {textFile};
600 564  
601   - boolean b = ftpClientUtils.uploadFile(url, port, username, password, path, filename, input);
  565 + File target = new File(odlGzFileName);
  566 +
  567 + File targetFile = test.pack(sources, target);
  568 +
  569 + clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());
602 570  
603 571 resultMap.put("status", ResponseCode.SUCCESS);
604 572  
... ... @@ -611,7 +579,96 @@ public class StationRouteServiceImpl extends BaseServiceImpl&lt;StationRoute, Integ
611 579 }
612 580 return resultMap;
613 581 }
  582 +
  583 + public String newTextFileToFTP(List<Object[]> objects) {
  584 +
  585 + String stationRStr = "";
  586 +
  587 + // windows下的文本文件换行符
  588 + String enterStr = "\r\n";
  589 +
  590 + // linux/unix下的文本文件换行符
  591 + // String enterStr = "\r";
  592 +
  593 + if(objects.size()>0) {
  594 +
  595 + for(int i = 0; i<objects.size();i++) {
  596 +
  597 + // 经度
  598 + String lng = objects.get(i)[0].toString();
  599 +
  600 + // 纬度
  601 + String lat = " " + objects.get(i)[1].toString();
  602 +
  603 + // 站点类型
  604 + String stationMake = objects.get(i)[3].toString();
  605 +
  606 + if(stationMake.equals("E")) {
  607 +
  608 + stationMake = " " + "2";
  609 +
  610 + }else {
  611 +
  612 + stationMake =" " + "1";
  613 +
  614 + }
  615 +
  616 + // 站点序号
  617 + String stationNo = " " + objects.get(i)[4].toString();
  618 +
  619 + // 站点编码
  620 + String stationCode = " " + objects.get(i)[5].toString();
  621 +
  622 + double tempd = Double.parseDouble(objects.get(i)[6].toString())*1000;
  623 +
  624 + // 站点距离
  625 + String staitondistance = " " + String.valueOf((int) tempd);
  626 +
  627 + // 限速
  628 + String sleepStr = " " + "60";
  629 +
  630 + // 站点名称
  631 + String staitonName = " " + objects.get(i)[7].toString();
  632 +
  633 + stationRStr = stationRStr + lng + lat + stationMake + stationNo + stationCode + staitondistance + sleepStr + staitonName + enterStr;
  634 +
  635 + }
  636 +
  637 + }
  638 +
  639 + return stationRStr;
  640 +
  641 + }
  642 +
  643 + public Map<String, Object> readPropertiesGetFTPParam(){
  644 +
  645 + Map<String, Object> resultMap = new HashMap<String, Object>();
  646 +
  647 + Properties env = new Properties();
  648 +
  649 + try {
  650 +
  651 + env.load(DBUtils_MS.class.getClassLoader().getResourceAsStream("ftp.properties"));
  652 +
  653 + resultMap.put("url", env.getProperty("ftp.url"));
  654 +
  655 + resultMap.put("port", env.getProperty("ftp.port"));
  656 +
  657 + resultMap.put("username", env.getProperty("ftp.username"));
  658 +
  659 + resultMap.put("password", env.getProperty("ftp.password"));
  660 +
  661 + resultMap.put("remotePath", env.getProperty("ftp.path"));
  662 +
  663 + } catch (Exception e) {
614 664  
  665 + e.printStackTrace();
  666 +
  667 + }
  668 +
  669 + return resultMap ;
  670 + }
  671 +
615 672 @Override
616 673 public List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map) {
617 674  
... ...
src/main/java/com/bsth/util/FTPClientUtils.java
... ... @@ -4,8 +4,10 @@ import java.io.ByteArrayInputStream;
4 4 import java.io.File;
5 5 import java.io.FileInputStream;
6 6 import java.io.FileNotFoundException;
  7 +import java.io.FileOutputStream;
7 8 import java.io.IOException;
8 9 import java.io.InputStream;
  10 +import java.io.OutputStream;
9 11 import java.io.UnsupportedEncodingException;
10 12  
11 13 import org.apache.commons.net.ftp.FTPClient;
... ... @@ -101,9 +103,9 @@ public class FTPClientUtils {
101 103 try {
102 104 FileInputStream in=new FileInputStream(file);
103 105  
104   - /*boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "C:/ftptest", name, in);*/
  106 + boolean flag = uploadFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", name, in);
105 107  
106   - boolean flag = uploadFile("222.66.0.205", 21, "transport", "transport123", "ftptest/", name, in);
  108 + /* boolean flag = uploadFile("222.66.0.205", 21, "transport", "transport123", "ftptest/", name, in);*/
107 109  
108 110 System.out.println(flag);
109 111  
... ... @@ -150,11 +152,11 @@ public class FTPClientUtils {
150 152 */
151 153 public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){
152 154  
153   - boolean success = true;
  155 + boolean success = false;
154 156  
155 157 FTPClient ftp = new FTPClient();
156 158  
157   - try{
  159 + try {
158 160  
159 161 int reply;
160 162  
... ... @@ -170,6 +172,8 @@ public class FTPClientUtils {
170 172 // 登录
171 173 ftp.login(username, password);
172 174  
  175 +
  176 +
173 177 reply = ftp.getReplyCode();
174 178  
175 179 if (!FTPReply.isPositiveCompletion(reply)) {
... ... @@ -183,13 +187,14 @@ public class FTPClientUtils {
183 187  
184 188 ftp.changeWorkingDirectory(remotePath);
185 189  
186   - success = ftp.deleteFile("C:/ftptest"+ "/" + "aa.txt");
  190 + success = ftp.deleteFile(fileName);
  191 +
  192 + ftp.logout();
187 193  
188   - ftp.logout();
189 194 } catch (IOException e){
190   - /*logger.error("save erro.", e);*/
191 195  
192 196 e.printStackTrace();
  197 +
193 198 success = false;
194 199  
195 200 } finally {
... ... @@ -201,8 +206,8 @@ public class FTPClientUtils {
201 206 ftp.disconnect();
202 207  
203 208 } catch (IOException e) {
  209 +
204 210 e.printStackTrace();
205   - /* logger.error(EXCEPTION_NAME, e); */
206 211  
207 212 }
208 213 }
... ... @@ -211,26 +216,119 @@ public class FTPClientUtils {
211 216 return success;
212 217 }
213 218  
  219 + public static File GetFtpFile(String url, int port, String username, String password, String remotePath, String fileName){
  220 +
  221 + FTPClient ftp = new FTPClient();
  222 +
  223 + File destFile = new File(fileName);
  224 +
  225 + InputStream in = null;
  226 +
  227 + OutputStream out = null;
  228 +
  229 + try {
  230 +
  231 + int reply;
  232 +
  233 + // 连接FTP服务器
  234 + if (port > -1)
  235 +
  236 + ftp.connect(url, port);
  237 +
  238 + else
  239 +
  240 + ftp.connect(url);
  241 +
  242 + // 登录
  243 + ftp.login(username, password);
  244 +
  245 + reply = ftp.getReplyCode();
  246 +
  247 + if (!FTPReply.isPositiveCompletion(reply)) {
  248 +
  249 + ftp.disconnect();
  250 +
  251 + }
  252 +
  253 + // 转移到FTP服务器目录
  254 +
  255 + ftp.changeWorkingDirectory(remotePath);
  256 +
  257 + File srcFile = new File(fileName);
  258 +
  259 + int byteread = 0; // 读取的字节数
  260 +
  261 + in = ftp.retrieveFileStream(fileName);
  262 +
  263 + out = new FileOutputStream(destFile);
  264 +
  265 + byte[] buffer = new byte[1024];
  266 +
  267 + while ((byteread = in.read(buffer)) != -1) {
  268 +
  269 + out.write(buffer, 0, byteread);
  270 +
  271 + }
  272 +
  273 + ftp.logout();
  274 +
  275 + } catch (IOException e){
  276 +
  277 + e.printStackTrace();
  278 +
  279 + } finally {
  280 +
  281 + try {
  282 +
  283 + if (out != null)
  284 +
  285 + out.close();
  286 +
  287 + if (in != null)
  288 +
  289 + in.close();
  290 +
  291 + } catch (IOException e) {
  292 +
  293 + e.printStackTrace();
  294 +
  295 + }
  296 +
  297 + if (ftp.isConnected()) {
  298 +
  299 + try {
  300 +
  301 + ftp.disconnect();
  302 +
  303 + } catch (IOException e) {
  304 +
  305 + e.printStackTrace();
  306 +
  307 + }
  308 + }
  309 + }
  310 +
  311 + return destFile;
  312 + }
  313 +
  314 +
214 315 public static void main(String[] args) {
215 316  
216 317 FTPClientUtils clientUtils = new FTPClientUtils();
217 318  
218 319 Test test= new Test();
219 320  
220   - /* File[] sources = new File[] {new File("E:/20079.txt")};
  321 + File[] sources = new File[] {new File("E:/20079.txt")};
221 322  
222 323 File target = new File("release_package.tar.gz");
223 324  
224 325 File targetFile = test.pack(sources, target);
225 326  
226   - clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());*/
  327 + clientUtils.testUpLoadFromDisk(targetFile,targetFile.getName());
227 328  
228   - /*, 21, , "123", "C:/ftptest", "test.txt", input*/
229 329  
230   - boolean a =clientUtils.deleteFtpFile("192.168.168.101", 21, "testftpservice", "123", "ftptest", "aa.txt");
  330 + /** 删除文件 */
  331 + /*boolean a =clientUtils.deleteFtpFile("192.168.168.101", 21, "testftpservice", "123", "ftptest/", "release_package.tar.gz");*/
231 332  
232   - System.out.println(a);
233   -
234   -
235 333 }
236 334 }
... ...
src/main/java/com/bsth/util/Test.java
... ... @@ -24,35 +24,57 @@ public class Test {
24 24 * @throws
25 25 */
26 26 public static File pack(File[] sources, File target){
27   - FileOutputStream out = null;
28   - try {
29   - out = new FileOutputStream(target);
30   - } catch (FileNotFoundException e1) {
31   - e1.printStackTrace();
32   - }
33   - TarArchiveOutputStream os = new TarArchiveOutputStream(out);
34   - for (File file : sources) {
35   - try {
36   - os.putArchiveEntry(new TarArchiveEntry(file));
37   - IOUtils.copy(new FileInputStream(file), os);
38   - os.closeArchiveEntry();
39   -
40   - } catch (FileNotFoundException e) {
41   - e.printStackTrace();
42   - } catch (IOException e) {
43   - e.printStackTrace();
44   - }
45   - }
46   - if(os != null) {
47   - try {
48   - os.flush();
49   - os.close();
50   - } catch (IOException e) {
51   - e.printStackTrace();
52   - }
53   - }
  27 +
  28 + FileOutputStream out = null;
  29 +
  30 + try {
  31 +
  32 + out = new FileOutputStream(target);
  33 +
  34 + } catch (FileNotFoundException e1) {
  35 +
  36 + e1.printStackTrace();
  37 +
  38 + }
  39 +
  40 + TarArchiveOutputStream os = new TarArchiveOutputStream(out);
  41 +
  42 + for (File file : sources) {
  43 +
  44 + try {
  45 +
  46 + os.putArchiveEntry(new TarArchiveEntry(file));
  47 +
  48 + IOUtils.copy(new FileInputStream(file), os);
  49 +
  50 + os.closeArchiveEntry();
  51 +
  52 + } catch (FileNotFoundException e) {
  53 +
  54 + e.printStackTrace();
  55 +
  56 + } catch (IOException e) {
  57 +
  58 + e.printStackTrace();
  59 +
  60 + }
  61 + }
  62 + if(os != null) {
  63 +
  64 + try {
  65 +
  66 + os.flush();
  67 +
  68 + os.close();
  69 +
  70 + } catch (IOException e) {
  71 +
  72 + e.printStackTrace();
  73 + }
  74 + }
54 75  
55 76 return target;
  77 +
56 78 }
57 79  
58 80 /**
... ...
src/main/resources/ftp.properties 0 → 100644
  1 +ftp.url=222.66.0.205
  2 +ftp.port=21
  3 +ftp.username=transport
  4 +ftp.password= transport123
  5 +ftp.path= down/
  6 +
  7 +#ftp.url=192.168.168.101
  8 +#ftp.port=21
  9 +#ftp.username=testftpservice
  10 +#ftp.password= 123
  11 +#ftp.path= ftptest/
0 12 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/js/line-list-table.js
... ... @@ -14,7 +14,7 @@
14 14  
15 15 (function(){
16 16  
17   - // 填充公司下拉框选择值
  17 + /** 填充公司下拉框选择值 */
18 18 $get('/business/all', {upCode_eq: '88'}, function(array){
19 19  
20 20 // 公司下拉options属性值
... ... @@ -32,10 +32,10 @@
32 32  
33 33 });
34 34  
35   - // 填充分公司下拉框
  35 + /** 填充分公司下拉框 */
36 36 setbrancheCompanySelectOptions();
37 37  
38   - // 填充分公司下拉框选择值
  38 + /** 填充分公司下拉框选择值 */
39 39 function setbrancheCompanySelectOptions(){
40 40  
41 41 // 获取公司下拉框选择值
... ... @@ -77,39 +77,45 @@
77 77 // 表格数据分页加载
78 78 loadTableDate(null,true);
79 79  
80   - /**
81   - * 重置按钮事件
82   - *
83   - */
84   - $('tr.filter .filter-cancel').on('click',function(){
  80 + /** 重置按钮事件 */
  81 + $('tr.filter .filter-cancel').on('click',function() {
  82 +
85 83 // 清空搜索框值
86 84 $('tr.filter input,select').val('').change();
  85 +
87 86 // 重新加载表格数据
88 87 loadTableDate(null,true);
89 88 });
90 89  
91   - /**
92   - * 搜索按钮事件
93   - *
94   - */
  90 + /** 搜索按钮事件 */
95 91 $('tr.filter .filter-submit').on('click',function(){
  92 +
96 93 // cells 集合返回表格中所有(列)单元格的一个数组
97 94 var cells = $('tr.filter')[0].cells;
  95 +
98 96 // 搜索参数集合
99 97 var params = {};
  98 +
100 99 // 搜索字段名称
101 100 var name;
  101 +
102 102 // 遍历cells数组
103 103 $.each(cells, function(i, cell){
  104 +
104 105 // 获取第i列的input或者select集合
105 106 var items = $('input,select', cell);
  107 +
106 108 // 遍历items集合
107 109 for(var j = 0, item; item = items[j++];){
  110 +
108 111 // 获取字段名称
109 112 name = $(item).attr('name');
  113 +
110 114 if(name){
  115 +
111 116 // 赋取相对应的值
112 117 params[name] = $(item).val();
  118 +
113 119 }
114 120 }
115 121 });
... ... @@ -118,25 +124,27 @@
118 124 loadTableDate(params,true);
119 125 });
120 126  
121   - /**
122   - * 表格数据分页加载事件
123   - *
124   - * ------@param : 查询参数
125   - *
126   - * ------@isPon : 是否重新分页
127   - *
128   - */
  127 + /** 表格数据分页加载事件 @param:<param : 查询参数;isPon : 是否重新分页> */
129 128 function loadTableDate(param,isPon){
  129 +
130 130 // 搜索参数
131 131 var params = {};
132   - if(param)
  132 +
  133 + if(param) {
  134 +
133 135 params = param;
  136 +
  137 + }
  138 +
134 139 // 排序(按更新时间)
135 140 params['order'] = 'id';
  141 +
136 142 // 记录当前页数
137 143 params['page'] = page;
  144 +
138 145 // 弹出正在加载层
139 146 var i = layer.load(2);
  147 +
140 148 // 异步请求获取表格数据
141 149 $.get('/line',params,function(result){
142 150  
... ... @@ -147,67 +155,118 @@
147 155  
148 156 // 把数据填充到模版中
149 157 var tbodyHtml = template('line_list_temp',{list:result.content});
  158 +
150 159 // 把渲染好的模版html文本追加到表格中
151 160 $('#datatable_line tbody').html(tbodyHtml);
  161 +
152 162 // 制定复选框
153 163 $('#datatable_line tbody').find('.icheck').iCheck(icheckOptions);
  164 +
154 165 // 复选框改变事件
155 166 $('#datatable_line tbody').find('.icheck').on('ifChanged', iCheckChange);
  167 +
156 168 // 是重新分页且返回数据长度大于0
157 169 if(isPon && result.content.length > 0){
  170 +
158 171 // 重新分页
159 172 initPag = true;
  173 +
160 174 // 分页栏
161 175 showPagination(result);
162 176 }
  177 +
163 178 // 关闭弹出加载层
164 179 layer.close(i);
165 180 });
166 181 }
167 182  
168   - /**
169   - * 复选框组件
170   - *
171   - */
  183 + /** 复选框组件 */
172 184 function iCheckChange(){
  185 +
173 186 // 获取当前的父节点tr
174 187 var tr = $(this).parents('tr');
175 188  
176 189 // 判断当前是否选中
177   - if(this.checked)
  190 + if(this.checked) {
  191 +
178 192 // 选中,则增添父节点tr的样式
179 193 tr.addClass('row-active');
180   - else
  194 +
  195 + }else {
  196 +
181 197 // 未选中,则删除父节点tr的样式
182 198 tr.removeClass('row-active');
  199 +
  200 + }
  201 +
183 202 }
184 203  
185   - /**
186   - * 分页栏组件
187   - *
188   - */
  204 + /** 分页栏组件 */
189 205 function showPagination(data){
  206 +
190 207 // 分页组件
191 208 $('#pagination').jqPaginator({
  209 +
192 210 // 总页数
193 211 totalPages: data.totalPages,
  212 +
194 213 // 中间显示页数
195 214 visiblePages: 6,
  215 +
196 216 // 当前页
197 217 currentPage: page + 1,
  218 +
198 219 first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>',
  220 +
199 221 prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>',
  222 +
200 223 next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>',
  224 +
201 225 last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>',
  226 +
202 227 page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>',
  228 +
203 229 onPageChange: function (num, type) {
  230 +
204 231 if(initPag){
  232 +
205 233 initPag = false;
  234 +
206 235 return;
  236 +
207 237 }
  238 +
208 239 page = num - 1;
  240 +
209 241 loadTableDate(null, false);
210 242 }
211 243 });
212 244 }
  245 +
  246 + // 生成行单
  247 + $('#datatable_ajax_tools #createUsingSingle').on('click', function() {
  248 +
  249 + /*alert('aaa');*/
  250 +
  251 + /*var lineIdEvents = LineObj.getLineObj();
  252 +
  253 + var params = {lineId:lineIdEvents.id};
  254 +
  255 + GetAjaxData.createUsingSingle(params,function(data) {
  256 +
  257 + if(data.status=='SUCCESS') {
  258 +
  259 + // 弹出添加成功提示消息
  260 + layer.msg('生成成功...');
  261 +
  262 + }else {
  263 +
  264 + // 弹出添加失败提示消息
  265 + layer.msg('生成失败...');
  266 +
  267 + }
  268 +
  269 + });*/
  270 +
  271 + });
213 272 })();
214 273 \ No newline at end of file
... ...
src/main/resources/static/pages/base/line/list.html
... ... @@ -22,6 +22,25 @@
22 22 <div class="btn-group btn-group-devided" data-toggle="buttons">
23 23 <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路</a>
24 24 </div>
  25 + <div class="btn-group">
  26 + <a class="btn red btn-outline btn-circle" href="javascript:;" data-toggle="dropdown" aria-expanded="false"> <i class="fa fa-share"></i> <span class="hidden-xs"> 系统工具 </span> <i class="fa fa-angle-down"></i>
  27 + </a>
  28 + <ul class="dropdown-menu pull-right" id="datatable_ajax_tools">
  29 + <li>
  30 + <a href="javascript:;" data-action="0" id="createUsingSingle" class="tool-action"> <i class="fa fa-file-zip-o"></i> 生成路单文件</a>
  31 + </li>
  32 + <!-- <li><a href="javascript:;" data-action="0" class="tool-action"> <i class="fa fa-print"></i> 打印
  33 + </a></li>
  34 + <li><a href="javascript:;" data-action="1" class="tool-action"> <i class="fa fa-copy"></i> 复制
  35 + </a></li>
  36 + <li><a href="javascript:;" data-action="3" class="tool-action"> <i class="fa fa-file-excel-o"></i>
  37 + 导出Excel
  38 + </a></li>
  39 + <li class="divider"></li>
  40 + <li><a href="javascript:;" data-action="5" class="tool-action"> <i class="fa fa-refresh"></i> 刷新数据
  41 + </a></li> -->
  42 + </ul>
  43 + </div>
25 44 </div>
26 45 </div>
27 46 <div class="portlet-body">
... ... @@ -29,20 +48,22 @@
29 48 <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line">
30 49 <thead>
31 50 <tr role="row" class="heading">
32   - <th width="3%">序号</th>
  51 + <th width="2%">#</th>
  52 + <th width="4%">序号</th>
33 53 <th width="7%">线路编码</th>
34 54 <th width="8%">线路名称</th>
35 55 <th width="7%">所属公司</th>
36 56 <th width="8%">所属分公司</th>
37   - <th width="8%">线路性质</th>
38   - <th width="8%">线路等级</th>
  57 + <th width="6%">线路性质</th>
  58 + <th width="6%">线路等级</th>
39 59 <th width="7%">上海市线路编码</th>
40 60 <th width="7%">是否撤销</th>
41   - <th width="8%">线路标准</th>
42   - <th width="8%">站点详情</th>
  61 + <th width="6%">线路标准</th>
  62 + <th width="6%">站点详情</th>
43 63 <th width="14%">操作</th>
44 64 </tr>
45 65 <tr role="row" class="filter">
  66 + <td></td>
46 67 <td>#</td>
47 68 <td>
48 69 <input type="text" class="form-control form-filter input-sm" name="lineCode_eq">
... ... @@ -124,6 +145,9 @@
124 145 {{each list as obj i }}
125 146 <tr>
126 147 <td style="vertical-align: middle;">
  148 + <input type="checkbox" class="group-checkable icheck" value="{{obj.name}}" id="{{obj.id}}" data-id="{{obj.id}}" data-lineName="{{obj.name}}">
  149 + </td>
  150 + <td style="vertical-align: middle;">
127 151 {{(list.page*10)+(i+1)}}
128 152 </td>
129 153 <td>
... ... @@ -133,16 +157,102 @@
133 157 {{obj.name}}
134 158 </td>
135 159 <td>
136   - {{obj.company}}
  160 + {{if obj.company == '55'}}
  161 + 上南公司
  162 + {{else if obj.company == '22'}}
  163 + 金高公司
  164 + {{else if obj.company == '05'}}
  165 + 杨高公司
  166 + {{else if obj.company == '26'}}
  167 + 南汇公司
  168 + {{/if}}
137 169 </td>
138 170 <td>
139   - {{obj.brancheCompany}}
  171 + {{if obj.company == '55'}}
  172 +
  173 + {{if obj.brancheCompany == '1'}}
  174 + 上南二分公司
  175 + {{else if obj.brancheCompany == '2'}}
  176 + 上南三分公司
  177 + {{else if obj.brancheCompany == '3'}}
  178 + 上南六分公司
  179 + {{else if obj.brancheCompany == '4'}}
  180 + 上南一分公司
  181 + {{/if}}
  182 +
  183 + {{else if obj.company == '22'}}
  184 +
  185 + {{if obj.brancheCompany == '1'}}
  186 + 四分公司
  187 + {{else if obj.brancheCompany == '2'}}
  188 + 四分公司
  189 + {{else if obj.brancheCompany == '3'}}
  190 + 四分公司
  191 + {{else if obj.brancheCompany == '5'}}
  192 + 一分公司
  193 + {{/if}}
  194 +
  195 + {{else if obj.company == '05'}}
  196 +
  197 + {{if obj.brancheCompany == '1'}}
  198 + 川沙分公司
  199 + {{else if obj.brancheCompany == '2'}}
  200 + 金桥分公司
  201 + {{else if obj.brancheCompany == '3'}}
  202 + 芦潮港分公司
  203 + {{else if obj.brancheCompany == '5'}}
  204 + 杨高分公司
  205 + {{else if obj.brancheCompany == '6'}}
  206 + 周浦分公司
  207 + {{/if}}
  208 +
  209 + {{else if obj.company == '26'}}
  210 +
  211 + {{if obj.brancheCompany == '1'}}
  212 + 南汇一分
  213 + {{else if obj.brancheCompany == '2'}}
  214 + 南汇二分
  215 + {{else if obj.brancheCompany == '3'}}
  216 + 南汇三分
  217 + {{else if obj.brancheCompany == '4'}}
  218 + 南汇维修公司
  219 + {{else if obj.brancheCompany == '5'}}
  220 + 南汇公司
  221 + {{/if}}
  222 +
  223 + {{/if}}
140 224 </td>
141 225 <td>
142   - {{obj.nature}}
  226 + {{if obj.nature == 'lj'}}
  227 + 路救
  228 + {{else if obj.nature == 'bc'}}
  229 + 备车
  230 + {{else if obj.nature == 'dbc'}}
  231 + 定班车
  232 + {{else if obj.nature == 'yxl'}}
  233 + 夜宵路
  234 + {{else if obj.nature == 'cgxl'}}
  235 + 常规线路
  236 + {{else if obj.nature == 'gjxl'}}
  237 + 过江线路
  238 + {{else if obj.nature == 'csbs'}}
  239 + 穿梭巴士
  240 + {{else if obj.nature == 'tyxl'}}
  241 + 特约线路
  242 + {{else if obj.nature == 'qt'}}
  243 + 其他
  244 + {{else if obj.nature == 'cctxl'}}
  245 + 村村通线路
  246 + {{/if}}
143 247 </td>
144 248 <td>
145   - {{obj.level}}
  249 + {{if obj.level == '1'}}
  250 + 一级线路
  251 + {{else if obj.level == '2'}}
  252 + 二级线路
  253 + {{else if obj.level == '0'}}
  254 + 未知等级
  255 + {{/if}}
146 256 </td>
147 257 <td>
148 258 {{obj.shanghaiLinecode}}
... ...
src/main/resources/static/pages/base/stationroute/add.html
... ... @@ -234,9 +234,9 @@
234 234 </div>
235 235 <script type="text/javascript">
236 236  
237   -$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,addStationObj,lineObj,fun){
  237 +$('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,staobj,lineObj,fun){
238 238  
239   - var Station = addStationObj.getAddStation();
  239 + var Station = staobj.getAddStation();
240 240  
241 241 var Line = lineObj.getLineObj();
242 242  
... ... @@ -494,7 +494,7 @@ $(&#39;#add_station_mobal&#39;).on(&#39;AddStationMobal.show&#39;, function(e, addMap,ajaxd,addS
494 494 addMap.clearMarkAndOverlays();
495 495  
496 496 /** 设置新增站点集合对象为空 */
497   - addStationObj.setAddStation({});
  497 + staobj.setAddStation({});
498 498  
499 499 var add_direction_v = $('#stationdirSelect').val();
500 500  
... ...
src/main/resources/static/pages/base/stationroute/edit.html
... ... @@ -130,14 +130,14 @@
130 130 </div>
131 131  
132 132 <!-- 站点WGS经纬度 -->
133   - <div class="form-body">
  133 + <!-- <div class="form-body">
134 134 <div class="form-group">
135 135 <label class="col-md-3 control-label">站点WGS经纬度:</label>
136 136 <div class="col-md-6">
137 137 <input type="text" class="form-control" name="gJwpoints" id="gJwpointsInput" placeholder="站点WGS经纬度">
138 138 </div>
139 139 </div>
140   - </div>
  140 + </div> -->
141 141  
142 142 <!-- 范围图形类型 -->
143 143 <div class="form-body">
... ...
src/main/resources/static/pages/base/stationroute/editsection.html
... ... @@ -227,7 +227,7 @@ $(&#39;#edit_section_mobal&#39;).on(&#39;editSectionMobal_show&#39;, function(e, map_,ajaxd,sect
227 227  
228 228 $('#sectionrouteCodeSelect').html(options);
229 229  
230   - ajaxd.findUpStationRouteCode(lineId,dir,eq_stationRouteCode,function(str) {
  230 + ajaxd.findUpSectionRouteCode(lineId,dir,eq_stationRouteCode,function(str) {
231 231  
232 232 if(str.length>0){
233 233  
... ...
src/main/resources/static/pages/base/stationroute/js/addstationobj.js
... ... @@ -12,9 +12,9 @@ var AddStationObj = function () {
12 12 },
13 13  
14 14 /** 设置新增站点集合对象为空 */
15   - setAddStation : function(station) {
  15 + setAddStation : function(s) {
16 16  
17   - station = station;
  17 + station = s;
18 18 },
19 19  
20 20 /** 设置新增站点集合对象方向属性值 @param:<dir:方向(0:上行;1:下行)> */
... ...
src/main/resources/static/pages/base/stationroute/js/drawingManager.js
... ... @@ -130,7 +130,14 @@ var DrawingManagerObj = function () {
130 130 /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */
131 131 EditStationObj.setEitdBPolygonGrid(bPloygonGrid);
132 132  
133   - $.get('edit.html', function(m){$(pjaxContainer).append(m);});
  133 + // 加载编辑页面
  134 + $.get('edit.html', function(m){
  135 +
  136 + $(pjaxContainer).append(m);
  137 +
  138 + $('#edit_station_mobal').trigger('editSelectMobal_show', [WorldsBMap,GetAjaxData,EditStationObj,LineObj,PublicFunctions]);
  139 +
  140 + });
134 141 }
135 142  
136 143 }
... ... @@ -149,6 +156,11 @@ var DrawingManagerObj = function () {
149 156 // 设置属性
150 157 drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON);
151 158  
  159 + },
  160 +
  161 + closeDrawingManager : function() {
  162 +
  163 + drawingManager.close();
152 164 }
153 165 }
154 166  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-ajax-getdata.js
... ... @@ -102,7 +102,7 @@ var GetAjaxData = function(){
102 102 },
103 103  
104 104  
105   - findUpStationRouteCode : function(lineId,diraction,sectionRouteCode,callback) {
  105 + findUpSectionRouteCode : function(lineId,diraction,sectionRouteCode,callback) {
106 106  
107 107 $get('/sectionroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode},function(result) {
108 108  
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-events.js
... ... @@ -147,11 +147,11 @@ $(function(){
147 147 // 修改下行站点mobal页面
148 148 $('.module_tools #editDownStation').on('click', function(){
149 149  
150   - var sel = PublicFunctions.getCurrSelNode(directionUpValue);
  150 + var sel = PublicFunctions.getCurrSelNode(directionDownValue);
151 151  
152 152 if(sel.length==0 || sel[0].original.chaildredType !='station'){
153 153  
154   - layer.msg('请先选择要编辑的行站点!');
  154 + layer.msg('请先选择要编辑的行站点!');
155 155  
156 156 return;
157 157 }
... ... @@ -160,7 +160,7 @@ $(function(){
160 160  
161 161 $(pjaxContainer).append(m);
162 162  
163   - $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionUpValue]);
  163 + $('#edit_select_mobal').trigger('editSelectMobal_show', [WorldsBMap,DrawingManagerObj,GetAjaxData,EditStationObj,LineObj,PublicFunctions,directionDownValue]);
164 164 });
165 165  
166 166 });
... ... @@ -204,17 +204,17 @@ $(function(){
204 204 if(data.status=='SUCCESS') {
205 205  
206 206 // 弹出添加成功提示消息
207   - layer.msg('添加成功...');
  207 + layer.msg('生成成功...');
208 208  
209 209 }else {
210 210  
211 211 // 弹出添加失败提示消息
212   - layer.msg('添加失败...');
  212 + layer.msg('生成失败...');
213 213  
214 214 }
215 215  
216 216 });
217 217  
218   - });
  218 + });
219 219  
220 220 });
221 221 \ No newline at end of file
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-function.js
... ... @@ -452,7 +452,14 @@ var PublicFunctions = function () {
452 452  
453 453 if(sel.length==0 || sel[0].original.chaildredType !='section'){
454 454  
455   - layer.msg('请先选中要编辑的上行路段!');
  455 + if(direction_=='0') {
  456 +
  457 + layer.msg('请先选中要编辑的上行路段!');
  458 +
  459 + }else if(direction_=='1') {
  460 +
  461 + layer.msg('请先选中要编辑的下行路段!');
  462 + }
456 463  
457 464 return;
458 465 }
... ...
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
... ... @@ -41,7 +41,7 @@ var StationTreeData = function(){
41 41 }else if(shapesTypeT == 'd') {
42 42  
43 43 // 百度地图画多边形
44   - WorldsBMap.pointsPolygon(objStation);
  44 + WorldsBMap.pointsPolygon(data);
45 45  
46 46 }
47 47  
... ... @@ -104,6 +104,8 @@ var StationTreeData = function(){
104 104 btn : [ '确认并退出', '返回并继续' ]
105 105 }, function(index) {
106 106  
  107 + DrawingManagerObj.closeDrawingManager();
  108 +
107 109 PublicFunctions.editAChangeCssRemoveDisabled();
108 110  
109 111 // 关闭弹出层
... ... @@ -113,6 +115,7 @@ var StationTreeData = function(){
113 115  
114 116 WorldsBMap.pointsCircle(edtsta);
115 117  
  118 +
116 119 }else if(txType=='d') {
117 120  
118 121 // 百度地图画多边形
... ... @@ -150,6 +153,8 @@ var StationTreeData = function(){
150 153 // 百度地图画路段
151 154 PublicFunctions.linePanlThree(edtste.sectionrouteLine,polylineArray_,edtste.sectionrouteDirections);
152 155  
  156 + parmasObj();
  157 +
153 158 // upIsEidtStauts(objStation,chaildredType,len);
154 159  
155 160 },function(){
... ...