Commit f1bd53e3956b86cb0d62145c93652b836b196812
Merge branch 'master' of 192.168.168.201:panzhaov5/bsth_control
Showing
15 changed files
with
550 additions
and
169 deletions
src/main/java/com/bsth/service/impl/StationRouteServiceImpl.java
| 1 | package com.bsth.service.impl; | 1 | package com.bsth.service.impl; |
| 2 | 2 | ||
| 3 | import java.io.ByteArrayInputStream; | 3 | import java.io.ByteArrayInputStream; |
| 4 | +import java.io.File; | ||
| 4 | import java.io.InputStream; | 5 | import java.io.InputStream; |
| 5 | import java.util.ArrayList; | 6 | import java.util.ArrayList; |
| 6 | import java.util.HashMap; | 7 | import java.util.HashMap; |
| 7 | import java.util.List; | 8 | import java.util.List; |
| 8 | import java.util.Map; | 9 | import java.util.Map; |
| 10 | +import java.util.Properties; | ||
| 9 | 11 | ||
| 10 | import org.springframework.beans.factory.annotation.Autowired; | 12 | import org.springframework.beans.factory.annotation.Autowired; |
| 11 | import org.springframework.stereotype.Service; | 13 | import org.springframework.stereotype.Service; |
| @@ -20,6 +22,8 @@ import com.bsth.repository.StationRepository; | @@ -20,6 +22,8 @@ import com.bsth.repository.StationRepository; | ||
| 20 | import com.bsth.repository.StationRouteRepository; | 22 | import com.bsth.repository.StationRouteRepository; |
| 21 | import com.bsth.service.StationRouteService; | 23 | import com.bsth.service.StationRouteService; |
| 22 | import com.bsth.util.FTPClientUtils; | 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,93 +516,57 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 512 | // 获取线路ID | 516 | // 获取线路ID |
| 513 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); | 517 | Integer lineId = map.get("lineId").equals("") ? 0 : Integer.parseInt(map.get("lineId").toString()); |
| 514 | 518 | ||
| 519 | + /** 查询线路信息 */ | ||
| 515 | Line line = lineRepository.findOne(lineId); | 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 | resultMap.put("status", ResponseCode.SUCCESS); | 571 | resultMap.put("status", ResponseCode.SUCCESS); |
| 604 | 572 | ||
| @@ -611,7 +579,96 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | @@ -611,7 +579,96 @@ public class StationRouteServiceImpl extends BaseServiceImpl<StationRoute, Integ | ||
| 611 | } | 579 | } |
| 612 | return resultMap; | 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 | @Override | 672 | @Override |
| 616 | public List<Map<String, Object>> findStationRouteInfo(Map<String, Object> map) { | 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,8 +4,10 @@ import java.io.ByteArrayInputStream; | ||
| 4 | import java.io.File; | 4 | import java.io.File; |
| 5 | import java.io.FileInputStream; | 5 | import java.io.FileInputStream; |
| 6 | import java.io.FileNotFoundException; | 6 | import java.io.FileNotFoundException; |
| 7 | +import java.io.FileOutputStream; | ||
| 7 | import java.io.IOException; | 8 | import java.io.IOException; |
| 8 | import java.io.InputStream; | 9 | import java.io.InputStream; |
| 10 | +import java.io.OutputStream; | ||
| 9 | import java.io.UnsupportedEncodingException; | 11 | import java.io.UnsupportedEncodingException; |
| 10 | 12 | ||
| 11 | import org.apache.commons.net.ftp.FTPClient; | 13 | import org.apache.commons.net.ftp.FTPClient; |
| @@ -101,9 +103,9 @@ public class FTPClientUtils { | @@ -101,9 +103,9 @@ public class FTPClientUtils { | ||
| 101 | try { | 103 | try { |
| 102 | FileInputStream in=new FileInputStream(file); | 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 | System.out.println(flag); | 110 | System.out.println(flag); |
| 109 | 111 | ||
| @@ -150,11 +152,11 @@ public class FTPClientUtils { | @@ -150,11 +152,11 @@ public class FTPClientUtils { | ||
| 150 | */ | 152 | */ |
| 151 | public static boolean deleteFtpFile(String url, int port, String username, String password, String remotePath, String fileName){ | 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 | FTPClient ftp = new FTPClient(); | 157 | FTPClient ftp = new FTPClient(); |
| 156 | 158 | ||
| 157 | - try{ | 159 | + try { |
| 158 | 160 | ||
| 159 | int reply; | 161 | int reply; |
| 160 | 162 | ||
| @@ -170,6 +172,8 @@ public class FTPClientUtils { | @@ -170,6 +172,8 @@ public class FTPClientUtils { | ||
| 170 | // 登录 | 172 | // 登录 |
| 171 | ftp.login(username, password); | 173 | ftp.login(username, password); |
| 172 | 174 | ||
| 175 | + | ||
| 176 | + | ||
| 173 | reply = ftp.getReplyCode(); | 177 | reply = ftp.getReplyCode(); |
| 174 | 178 | ||
| 175 | if (!FTPReply.isPositiveCompletion(reply)) { | 179 | if (!FTPReply.isPositiveCompletion(reply)) { |
| @@ -183,13 +187,14 @@ public class FTPClientUtils { | @@ -183,13 +187,14 @@ public class FTPClientUtils { | ||
| 183 | 187 | ||
| 184 | ftp.changeWorkingDirectory(remotePath); | 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 | } catch (IOException e){ | 194 | } catch (IOException e){ |
| 190 | - /*logger.error("save erro.", e);*/ | ||
| 191 | 195 | ||
| 192 | e.printStackTrace(); | 196 | e.printStackTrace(); |
| 197 | + | ||
| 193 | success = false; | 198 | success = false; |
| 194 | 199 | ||
| 195 | } finally { | 200 | } finally { |
| @@ -201,8 +206,8 @@ public class FTPClientUtils { | @@ -201,8 +206,8 @@ public class FTPClientUtils { | ||
| 201 | ftp.disconnect(); | 206 | ftp.disconnect(); |
| 202 | 207 | ||
| 203 | } catch (IOException e) { | 208 | } catch (IOException e) { |
| 209 | + | ||
| 204 | e.printStackTrace(); | 210 | e.printStackTrace(); |
| 205 | - /* logger.error(EXCEPTION_NAME, e); */ | ||
| 206 | 211 | ||
| 207 | } | 212 | } |
| 208 | } | 213 | } |
| @@ -211,26 +216,119 @@ public class FTPClientUtils { | @@ -211,26 +216,119 @@ public class FTPClientUtils { | ||
| 211 | return success; | 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 | public static void main(String[] args) { | 315 | public static void main(String[] args) { |
| 215 | 316 | ||
| 216 | FTPClientUtils clientUtils = new FTPClientUtils(); | 317 | FTPClientUtils clientUtils = new FTPClientUtils(); |
| 217 | 318 | ||
| 218 | Test test= new Test(); | 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 | File target = new File("release_package.tar.gz"); | 323 | File target = new File("release_package.tar.gz"); |
| 223 | 324 | ||
| 224 | File targetFile = test.pack(sources, target); | 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,35 +24,57 @@ public class Test { | ||
| 24 | * @throws | 24 | * @throws |
| 25 | */ | 25 | */ |
| 26 | public static File pack(File[] sources, File target){ | 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 | return target; | 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 | \ No newline at end of file | 12 | \ No newline at end of file |
src/main/resources/static/pages/base/line/js/line-list-table.js
| @@ -14,7 +14,7 @@ | @@ -14,7 +14,7 @@ | ||
| 14 | 14 | ||
| 15 | (function(){ | 15 | (function(){ |
| 16 | 16 | ||
| 17 | - // 填充公司下拉框选择值 | 17 | + /** 填充公司下拉框选择值 */ |
| 18 | $get('/business/all', {upCode_eq: '88'}, function(array){ | 18 | $get('/business/all', {upCode_eq: '88'}, function(array){ |
| 19 | 19 | ||
| 20 | // 公司下拉options属性值 | 20 | // 公司下拉options属性值 |
| @@ -32,10 +32,10 @@ | @@ -32,10 +32,10 @@ | ||
| 32 | 32 | ||
| 33 | }); | 33 | }); |
| 34 | 34 | ||
| 35 | - // 填充分公司下拉框 | 35 | + /** 填充分公司下拉框 */ |
| 36 | setbrancheCompanySelectOptions(); | 36 | setbrancheCompanySelectOptions(); |
| 37 | 37 | ||
| 38 | - // 填充分公司下拉框选择值 | 38 | + /** 填充分公司下拉框选择值 */ |
| 39 | function setbrancheCompanySelectOptions(){ | 39 | function setbrancheCompanySelectOptions(){ |
| 40 | 40 | ||
| 41 | // 获取公司下拉框选择值 | 41 | // 获取公司下拉框选择值 |
| @@ -77,39 +77,45 @@ | @@ -77,39 +77,45 @@ | ||
| 77 | // 表格数据分页加载 | 77 | // 表格数据分页加载 |
| 78 | loadTableDate(null,true); | 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 | $('tr.filter input,select').val('').change(); | 84 | $('tr.filter input,select').val('').change(); |
| 85 | + | ||
| 87 | // 重新加载表格数据 | 86 | // 重新加载表格数据 |
| 88 | loadTableDate(null,true); | 87 | loadTableDate(null,true); |
| 89 | }); | 88 | }); |
| 90 | 89 | ||
| 91 | - /** | ||
| 92 | - * 搜索按钮事件 | ||
| 93 | - * | ||
| 94 | - */ | 90 | + /** 搜索按钮事件 */ |
| 95 | $('tr.filter .filter-submit').on('click',function(){ | 91 | $('tr.filter .filter-submit').on('click',function(){ |
| 92 | + | ||
| 96 | // cells 集合返回表格中所有(列)单元格的一个数组 | 93 | // cells 集合返回表格中所有(列)单元格的一个数组 |
| 97 | var cells = $('tr.filter')[0].cells; | 94 | var cells = $('tr.filter')[0].cells; |
| 95 | + | ||
| 98 | // 搜索参数集合 | 96 | // 搜索参数集合 |
| 99 | var params = {}; | 97 | var params = {}; |
| 98 | + | ||
| 100 | // 搜索字段名称 | 99 | // 搜索字段名称 |
| 101 | var name; | 100 | var name; |
| 101 | + | ||
| 102 | // 遍历cells数组 | 102 | // 遍历cells数组 |
| 103 | $.each(cells, function(i, cell){ | 103 | $.each(cells, function(i, cell){ |
| 104 | + | ||
| 104 | // 获取第i列的input或者select集合 | 105 | // 获取第i列的input或者select集合 |
| 105 | var items = $('input,select', cell); | 106 | var items = $('input,select', cell); |
| 107 | + | ||
| 106 | // 遍历items集合 | 108 | // 遍历items集合 |
| 107 | for(var j = 0, item; item = items[j++];){ | 109 | for(var j = 0, item; item = items[j++];){ |
| 110 | + | ||
| 108 | // 获取字段名称 | 111 | // 获取字段名称 |
| 109 | name = $(item).attr('name'); | 112 | name = $(item).attr('name'); |
| 113 | + | ||
| 110 | if(name){ | 114 | if(name){ |
| 115 | + | ||
| 111 | // 赋取相对应的值 | 116 | // 赋取相对应的值 |
| 112 | params[name] = $(item).val(); | 117 | params[name] = $(item).val(); |
| 118 | + | ||
| 113 | } | 119 | } |
| 114 | } | 120 | } |
| 115 | }); | 121 | }); |
| @@ -118,25 +124,27 @@ | @@ -118,25 +124,27 @@ | ||
| 118 | loadTableDate(params,true); | 124 | loadTableDate(params,true); |
| 119 | }); | 125 | }); |
| 120 | 126 | ||
| 121 | - /** | ||
| 122 | - * 表格数据分页加载事件 | ||
| 123 | - * | ||
| 124 | - * ------@param : 查询参数 | ||
| 125 | - * | ||
| 126 | - * ------@isPon : 是否重新分页 | ||
| 127 | - * | ||
| 128 | - */ | 127 | + /** 表格数据分页加载事件 @param:<param : 查询参数;isPon : 是否重新分页> */ |
| 129 | function loadTableDate(param,isPon){ | 128 | function loadTableDate(param,isPon){ |
| 129 | + | ||
| 130 | // 搜索参数 | 130 | // 搜索参数 |
| 131 | var params = {}; | 131 | var params = {}; |
| 132 | - if(param) | 132 | + |
| 133 | + if(param) { | ||
| 134 | + | ||
| 133 | params = param; | 135 | params = param; |
| 136 | + | ||
| 137 | + } | ||
| 138 | + | ||
| 134 | // 排序(按更新时间) | 139 | // 排序(按更新时间) |
| 135 | params['order'] = 'id'; | 140 | params['order'] = 'id'; |
| 141 | + | ||
| 136 | // 记录当前页数 | 142 | // 记录当前页数 |
| 137 | params['page'] = page; | 143 | params['page'] = page; |
| 144 | + | ||
| 138 | // 弹出正在加载层 | 145 | // 弹出正在加载层 |
| 139 | var i = layer.load(2); | 146 | var i = layer.load(2); |
| 147 | + | ||
| 140 | // 异步请求获取表格数据 | 148 | // 异步请求获取表格数据 |
| 141 | $.get('/line',params,function(result){ | 149 | $.get('/line',params,function(result){ |
| 142 | 150 | ||
| @@ -147,67 +155,118 @@ | @@ -147,67 +155,118 @@ | ||
| 147 | 155 | ||
| 148 | // 把数据填充到模版中 | 156 | // 把数据填充到模版中 |
| 149 | var tbodyHtml = template('line_list_temp',{list:result.content}); | 157 | var tbodyHtml = template('line_list_temp',{list:result.content}); |
| 158 | + | ||
| 150 | // 把渲染好的模版html文本追加到表格中 | 159 | // 把渲染好的模版html文本追加到表格中 |
| 151 | $('#datatable_line tbody').html(tbodyHtml); | 160 | $('#datatable_line tbody').html(tbodyHtml); |
| 161 | + | ||
| 152 | // 制定复选框 | 162 | // 制定复选框 |
| 153 | $('#datatable_line tbody').find('.icheck').iCheck(icheckOptions); | 163 | $('#datatable_line tbody').find('.icheck').iCheck(icheckOptions); |
| 164 | + | ||
| 154 | // 复选框改变事件 | 165 | // 复选框改变事件 |
| 155 | $('#datatable_line tbody').find('.icheck').on('ifChanged', iCheckChange); | 166 | $('#datatable_line tbody').find('.icheck').on('ifChanged', iCheckChange); |
| 167 | + | ||
| 156 | // 是重新分页且返回数据长度大于0 | 168 | // 是重新分页且返回数据长度大于0 |
| 157 | if(isPon && result.content.length > 0){ | 169 | if(isPon && result.content.length > 0){ |
| 170 | + | ||
| 158 | // 重新分页 | 171 | // 重新分页 |
| 159 | initPag = true; | 172 | initPag = true; |
| 173 | + | ||
| 160 | // 分页栏 | 174 | // 分页栏 |
| 161 | showPagination(result); | 175 | showPagination(result); |
| 162 | } | 176 | } |
| 177 | + | ||
| 163 | // 关闭弹出加载层 | 178 | // 关闭弹出加载层 |
| 164 | layer.close(i); | 179 | layer.close(i); |
| 165 | }); | 180 | }); |
| 166 | } | 181 | } |
| 167 | 182 | ||
| 168 | - /** | ||
| 169 | - * 复选框组件 | ||
| 170 | - * | ||
| 171 | - */ | 183 | + /** 复选框组件 */ |
| 172 | function iCheckChange(){ | 184 | function iCheckChange(){ |
| 185 | + | ||
| 173 | // 获取当前的父节点tr | 186 | // 获取当前的父节点tr |
| 174 | var tr = $(this).parents('tr'); | 187 | var tr = $(this).parents('tr'); |
| 175 | 188 | ||
| 176 | // 判断当前是否选中 | 189 | // 判断当前是否选中 |
| 177 | - if(this.checked) | 190 | + if(this.checked) { |
| 191 | + | ||
| 178 | // 选中,则增添父节点tr的样式 | 192 | // 选中,则增添父节点tr的样式 |
| 179 | tr.addClass('row-active'); | 193 | tr.addClass('row-active'); |
| 180 | - else | 194 | + |
| 195 | + }else { | ||
| 196 | + | ||
| 181 | // 未选中,则删除父节点tr的样式 | 197 | // 未选中,则删除父节点tr的样式 |
| 182 | tr.removeClass('row-active'); | 198 | tr.removeClass('row-active'); |
| 199 | + | ||
| 200 | + } | ||
| 201 | + | ||
| 183 | } | 202 | } |
| 184 | 203 | ||
| 185 | - /** | ||
| 186 | - * 分页栏组件 | ||
| 187 | - * | ||
| 188 | - */ | 204 | + /** 分页栏组件 */ |
| 189 | function showPagination(data){ | 205 | function showPagination(data){ |
| 206 | + | ||
| 190 | // 分页组件 | 207 | // 分页组件 |
| 191 | $('#pagination').jqPaginator({ | 208 | $('#pagination').jqPaginator({ |
| 209 | + | ||
| 192 | // 总页数 | 210 | // 总页数 |
| 193 | totalPages: data.totalPages, | 211 | totalPages: data.totalPages, |
| 212 | + | ||
| 194 | // 中间显示页数 | 213 | // 中间显示页数 |
| 195 | visiblePages: 6, | 214 | visiblePages: 6, |
| 215 | + | ||
| 196 | // 当前页 | 216 | // 当前页 |
| 197 | currentPage: page + 1, | 217 | currentPage: page + 1, |
| 218 | + | ||
| 198 | first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', | 219 | first: '<li class="first"><a href="javascript:void(0);">首页<\/a><\/li>', |
| 220 | + | ||
| 199 | prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', | 221 | prev: '<li class="prev"><a href="javascript:void(0);">上一页<\/a><\/li>', |
| 222 | + | ||
| 200 | next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', | 223 | next: '<li class="next"><a href="javascript:void(0);">下一页<\/a><\/li>', |
| 224 | + | ||
| 201 | last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', | 225 | last: '<li class="last"><a href="javascript:void(0);">尾页<\/a><\/li>', |
| 226 | + | ||
| 202 | page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', | 227 | page: '<li class="page"><a href="javascript:void(0);">{{page}}<\/a><\/li>', |
| 228 | + | ||
| 203 | onPageChange: function (num, type) { | 229 | onPageChange: function (num, type) { |
| 230 | + | ||
| 204 | if(initPag){ | 231 | if(initPag){ |
| 232 | + | ||
| 205 | initPag = false; | 233 | initPag = false; |
| 234 | + | ||
| 206 | return; | 235 | return; |
| 236 | + | ||
| 207 | } | 237 | } |
| 238 | + | ||
| 208 | page = num - 1; | 239 | page = num - 1; |
| 240 | + | ||
| 209 | loadTableDate(null, false); | 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 | \ No newline at end of file | 273 | \ No newline at end of file |
src/main/resources/static/pages/base/line/list.html
| @@ -22,6 +22,25 @@ | @@ -22,6 +22,25 @@ | ||
| 22 | <div class="btn-group btn-group-devided" data-toggle="buttons"> | 22 | <div class="btn-group btn-group-devided" data-toggle="buttons"> |
| 23 | <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路</a> | 23 | <a class="btn btn-circle blue" href="add.html" data-pjax><i class="fa fa-plus"></i> 添加线路</a> |
| 24 | </div> | 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 | </div> | 44 | </div> |
| 26 | </div> | 45 | </div> |
| 27 | <div class="portlet-body"> | 46 | <div class="portlet-body"> |
| @@ -29,20 +48,22 @@ | @@ -29,20 +48,22 @@ | ||
| 29 | <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line"> | 48 | <table class="table table-striped table-bordered table-hover table-checkable" id="datatable_line"> |
| 30 | <thead> | 49 | <thead> |
| 31 | <tr role="row" class="heading"> | 50 | <tr role="row" class="heading"> |
| 32 | - <th width="3%">序号</th> | 51 | + <th width="2%">#</th> |
| 52 | + <th width="4%">序号</th> | ||
| 33 | <th width="7%">线路编码</th> | 53 | <th width="7%">线路编码</th> |
| 34 | <th width="8%">线路名称</th> | 54 | <th width="8%">线路名称</th> |
| 35 | <th width="7%">所属公司</th> | 55 | <th width="7%">所属公司</th> |
| 36 | <th width="8%">所属分公司</th> | 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 | <th width="7%">上海市线路编码</th> | 59 | <th width="7%">上海市线路编码</th> |
| 40 | <th width="7%">是否撤销</th> | 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 | <th width="14%">操作</th> | 63 | <th width="14%">操作</th> |
| 44 | </tr> | 64 | </tr> |
| 45 | <tr role="row" class="filter"> | 65 | <tr role="row" class="filter"> |
| 66 | + <td></td> | ||
| 46 | <td>#</td> | 67 | <td>#</td> |
| 47 | <td> | 68 | <td> |
| 48 | <input type="text" class="form-control form-filter input-sm" name="lineCode_eq"> | 69 | <input type="text" class="form-control form-filter input-sm" name="lineCode_eq"> |
| @@ -124,6 +145,9 @@ | @@ -124,6 +145,9 @@ | ||
| 124 | {{each list as obj i }} | 145 | {{each list as obj i }} |
| 125 | <tr> | 146 | <tr> |
| 126 | <td style="vertical-align: middle;"> | 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 | {{(list.page*10)+(i+1)}} | 151 | {{(list.page*10)+(i+1)}} |
| 128 | </td> | 152 | </td> |
| 129 | <td> | 153 | <td> |
| @@ -133,16 +157,102 @@ | @@ -133,16 +157,102 @@ | ||
| 133 | {{obj.name}} | 157 | {{obj.name}} |
| 134 | </td> | 158 | </td> |
| 135 | <td> | 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 | </td> | 169 | </td> |
| 138 | <td> | 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 | </td> | 224 | </td> |
| 141 | <td> | 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 | </td> | 247 | </td> |
| 144 | <td> | 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 | </td> | 256 | </td> |
| 147 | <td> | 257 | <td> |
| 148 | {{obj.shanghaiLinecode}} | 258 | {{obj.shanghaiLinecode}} |
src/main/resources/static/pages/base/stationroute/add.html
| @@ -234,9 +234,9 @@ | @@ -234,9 +234,9 @@ | ||
| 234 | </div> | 234 | </div> |
| 235 | <script type="text/javascript"> | 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 | var Line = lineObj.getLineObj(); | 241 | var Line = lineObj.getLineObj(); |
| 242 | 242 | ||
| @@ -494,7 +494,7 @@ $('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,addS | @@ -494,7 +494,7 @@ $('#add_station_mobal').on('AddStationMobal.show', function(e, addMap,ajaxd,addS | ||
| 494 | addMap.clearMarkAndOverlays(); | 494 | addMap.clearMarkAndOverlays(); |
| 495 | 495 | ||
| 496 | /** 设置新增站点集合对象为空 */ | 496 | /** 设置新增站点集合对象为空 */ |
| 497 | - addStationObj.setAddStation({}); | 497 | + staobj.setAddStation({}); |
| 498 | 498 | ||
| 499 | var add_direction_v = $('#stationdirSelect').val(); | 499 | var add_direction_v = $('#stationdirSelect').val(); |
| 500 | 500 |
src/main/resources/static/pages/base/stationroute/edit.html
| @@ -130,14 +130,14 @@ | @@ -130,14 +130,14 @@ | ||
| 130 | </div> | 130 | </div> |
| 131 | 131 | ||
| 132 | <!-- 站点WGS经纬度 --> | 132 | <!-- 站点WGS经纬度 --> |
| 133 | - <div class="form-body"> | 133 | + <!-- <div class="form-body"> |
| 134 | <div class="form-group"> | 134 | <div class="form-group"> |
| 135 | <label class="col-md-3 control-label">站点WGS经纬度:</label> | 135 | <label class="col-md-3 control-label">站点WGS经纬度:</label> |
| 136 | <div class="col-md-6"> | 136 | <div class="col-md-6"> |
| 137 | <input type="text" class="form-control" name="gJwpoints" id="gJwpointsInput" placeholder="站点WGS经纬度"> | 137 | <input type="text" class="form-control" name="gJwpoints" id="gJwpointsInput" placeholder="站点WGS经纬度"> |
| 138 | </div> | 138 | </div> |
| 139 | </div> | 139 | </div> |
| 140 | - </div> | 140 | + </div> --> |
| 141 | 141 | ||
| 142 | <!-- 范围图形类型 --> | 142 | <!-- 范围图形类型 --> |
| 143 | <div class="form-body"> | 143 | <div class="form-body"> |
src/main/resources/static/pages/base/stationroute/editsection.html
| @@ -227,7 +227,7 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect | @@ -227,7 +227,7 @@ $('#edit_section_mobal').on('editSectionMobal_show', function(e, map_,ajaxd,sect | ||
| 227 | 227 | ||
| 228 | $('#sectionrouteCodeSelect').html(options); | 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 | if(str.length>0){ | 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,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 | /** 设置新增站点集合对象方向属性值 @param:<dir:方向(0:上行;1:下行)> */ | 20 | /** 设置新增站点集合对象方向属性值 @param:<dir:方向(0:上行;1:下行)> */ |
src/main/resources/static/pages/base/stationroute/js/drawingManager.js
| @@ -130,7 +130,14 @@ var DrawingManagerObj = function () { | @@ -130,7 +130,14 @@ var DrawingManagerObj = function () { | ||
| 130 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ | 130 | /** 设置修改站点集合对象图形百度坐标集合属性值 @param:<bPolygonGrid:图形百度坐标集合) */ |
| 131 | EditStationObj.setEitdBPolygonGrid(bPloygonGrid); | 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,6 +156,11 @@ var DrawingManagerObj = function () { | ||
| 149 | // 设置属性 | 156 | // 设置属性 |
| 150 | drawingManager.setDrawingMode(BMAP_DRAWING_POLYGON); | 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,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 | $get('/sectionroute/findUpStationRouteCode',{lineId:lineId,direction:diraction,sectionRouteCode:sectionRouteCode},function(result) { | 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,11 +147,11 @@ $(function(){ | ||
| 147 | // 修改下行站点mobal页面 | 147 | // 修改下行站点mobal页面 |
| 148 | $('.module_tools #editDownStation').on('click', function(){ | 148 | $('.module_tools #editDownStation').on('click', function(){ |
| 149 | 149 | ||
| 150 | - var sel = PublicFunctions.getCurrSelNode(directionUpValue); | 150 | + var sel = PublicFunctions.getCurrSelNode(directionDownValue); |
| 151 | 151 | ||
| 152 | if(sel.length==0 || sel[0].original.chaildredType !='station'){ | 152 | if(sel.length==0 || sel[0].original.chaildredType !='station'){ |
| 153 | 153 | ||
| 154 | - layer.msg('请先选择要编辑的上行站点!'); | 154 | + layer.msg('请先选择要编辑的下行站点!'); |
| 155 | 155 | ||
| 156 | return; | 156 | return; |
| 157 | } | 157 | } |
| @@ -160,7 +160,7 @@ $(function(){ | @@ -160,7 +160,7 @@ $(function(){ | ||
| 160 | 160 | ||
| 161 | $(pjaxContainer).append(m); | 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,17 +204,17 @@ $(function(){ | ||
| 204 | if(data.status=='SUCCESS') { | 204 | if(data.status=='SUCCESS') { |
| 205 | 205 | ||
| 206 | // 弹出添加成功提示消息 | 206 | // 弹出添加成功提示消息 |
| 207 | - layer.msg('添加成功...'); | 207 | + layer.msg('生成成功...'); |
| 208 | 208 | ||
| 209 | }else { | 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 | \ No newline at end of file | 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,7 +452,14 @@ var PublicFunctions = function () { | ||
| 452 | 452 | ||
| 453 | if(sel.length==0 || sel[0].original.chaildredType !='section'){ | 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 | return; | 464 | return; |
| 458 | } | 465 | } |
src/main/resources/static/pages/base/stationroute/js/stationroute-list-treedata.js
| @@ -41,7 +41,7 @@ var StationTreeData = function(){ | @@ -41,7 +41,7 @@ var StationTreeData = function(){ | ||
| 41 | }else if(shapesTypeT == 'd') { | 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,6 +104,8 @@ var StationTreeData = function(){ | ||
| 104 | btn : [ '确认并退出', '返回并继续' ] | 104 | btn : [ '确认并退出', '返回并继续' ] |
| 105 | }, function(index) { | 105 | }, function(index) { |
| 106 | 106 | ||
| 107 | + DrawingManagerObj.closeDrawingManager(); | ||
| 108 | + | ||
| 107 | PublicFunctions.editAChangeCssRemoveDisabled(); | 109 | PublicFunctions.editAChangeCssRemoveDisabled(); |
| 108 | 110 | ||
| 109 | // 关闭弹出层 | 111 | // 关闭弹出层 |
| @@ -113,6 +115,7 @@ var StationTreeData = function(){ | @@ -113,6 +115,7 @@ var StationTreeData = function(){ | ||
| 113 | 115 | ||
| 114 | WorldsBMap.pointsCircle(edtsta); | 116 | WorldsBMap.pointsCircle(edtsta); |
| 115 | 117 | ||
| 118 | + | ||
| 116 | }else if(txType=='d') { | 119 | }else if(txType=='d') { |
| 117 | 120 | ||
| 118 | // 百度地图画多边形 | 121 | // 百度地图画多边形 |
| @@ -150,6 +153,8 @@ var StationTreeData = function(){ | @@ -150,6 +153,8 @@ var StationTreeData = function(){ | ||
| 150 | // 百度地图画路段 | 153 | // 百度地图画路段 |
| 151 | PublicFunctions.linePanlThree(edtste.sectionrouteLine,polylineArray_,edtste.sectionrouteDirections); | 154 | PublicFunctions.linePanlThree(edtste.sectionrouteLine,polylineArray_,edtste.sectionrouteDirections); |
| 152 | 155 | ||
| 156 | + parmasObj(); | ||
| 157 | + | ||
| 153 | // upIsEidtStauts(objStation,chaildredType,len); | 158 | // upIsEidtStauts(objStation,chaildredType,len); |
| 154 | 159 | ||
| 155 | },function(){ | 160 | },function(){ |